thebardingreen

joined 2 years ago
[–] thebardingreen@lemmy.starlightkel.xyz 19 points 2 days ago (5 children)

I know an engineer who had several ponds near his property who built an elaborate contraption to attract and electrocute them. He killed tens of thousands. Hundreds more ignored it and bit him anyway.

[–] thebardingreen@lemmy.starlightkel.xyz 2 points 4 days ago* (last edited 4 days ago)

Very rarely, but probably only in situations where you would too. No, usually I put my HTML in HTML files. They're usually building blocks... page components, not a full page. I regulate the page flow in PHP, and I don't like it cluttered up with tons of HTML, inside or outside of echos. I have been known to do stuff like this though:

echo "".$Page->pagecomponents['contents_of_some_html_file']."";

If I go and look at $Page, it will show that $this->pagecomponents is set by reading my template files in so I can grab HTML structures dynamically. If the contents of pagecomponents['component'] are set dynamically (they usually are), there won't be some ugly <php ?> tag in the HTML file, but my $Page class will handle populating it somehow. The architecture I usually use is $Validator is instantiated for a page load, then $Data, so whatever user activity $Validator has detected and cleaned up tells $Data what to do with the data backend (which is usually a combination of Maria and Redis) then $Data gets fed into $Page which figures out what page to build, looks at all my HTML building blocks and figures out how to put them together and populate whatever it needs to. So it will usually be something like (very simplistically)

$Validator = new Validator($_GET, $_POST);

$Data = new Data($Validator); $Page = new Page($Data);

renderPage($Page->Page);

[–] thebardingreen@lemmy.starlightkel.xyz 8 points 4 days ago (1 children)

Bad ass answer.

[–] thebardingreen@lemmy.starlightkel.xyz 2 points 4 days ago (1 children)

I don't like reading it captain pedantic. Deal with it. :)

[–] thebardingreen@lemmy.starlightkel.xyz 3 points 4 days ago* (last edited 4 days ago) (6 children)

On the one hand, you do have good reasons to use classes.

  1. Interacting with your database.
  2. Sanitizing your inputs.
  3. Building pages from templates.

Rather than piecemeal loading all these functions from every page where a bunch of them aren't being used, you can create three classes.

  1. has all your database interactions in it and then you can treat all database interactions as an object. My queries are usually all executed with $Data->runQuery();

  2. Since you're working in raw PHP with no frameworks or libraries, you NEED to validate every input users send, or bots are going to spam the shit out of your database. The way you have things now, you're probably either calling some function(s) on every form submit (every time $_SERVER['request_method']==='POST') OR you're just not doing it. When working in raw PHP, I always write a Validator class which sits in between every $_GET and $_POST and makes damn sure what ever is coming in meets a set of criteria that I expect. I'm happy to go into the architecture of this with you if that would be helpful.

  3. I'm assuming you might have something for each page like

include('header.php');

include('footer.php');

Instead, I like to write a page builder class that constructs my pages dynamically based on routing. So then any given page becomes and instance of $Page and you populate it with various methods (like $Page->renderForm('form');) You can also then base the routing logic on your form submissions.

On the other hand... it's probably fine at this stage to just not use classes and if it works, why fix it?

You probably feel like you don't have a need for classes because you're just not comfortable working with them yet, and need more experience thinking through architecture. This is fine. This is normal. This is exactly where you should be, given what you say about your experience level.

SQL injection probably didn't work because PDO protects you from that to some extent. Doesn't mean you shouldn't account for it in your input processing.

Most of my HTML comes from echo.

Good, it should. I effing HATE reading through code where people are tagging in and out of PHP all the time. It looks so ugly. That's not a standard best practice, just MY personal practice. IMHO, for HUMAN readability purposes, HTML should either be in echos or template files.

I fricken hate this: <a> <bunch> <of> <html> <php? run_some_php('here'); />

Don't effing make me read that. I co-run an independent coding shop and whenever we work in PHP, I tell people please not to do that.

[–] thebardingreen@lemmy.starlightkel.xyz 8 points 6 days ago (1 children)

Hammond is 100% exactly the kind of guy who would have been to the island dozens of times.

[–] thebardingreen@lemmy.starlightkel.xyz 2 points 6 days ago (1 children)

Coconuts are tropical! This is a temperate zone!

[–] thebardingreen@lemmy.starlightkel.xyz 6 points 1 week ago (1 children)

How do reavers clean their harpoons?

[–] thebardingreen@lemmy.starlightkel.xyz 13 points 3 weeks ago (4 children)

Doesn’t it sort of defeat the purpose of gasoline being used because it’s so energy dense? Like, this seems to suggest little more than the benefits of electrification in transport.

It allows you to extend the use of gasoline vehicles into an electric future. Fueling gasoline vehicles for $1.50 a gallon is also a wonderful eff you to the oil companies (I'm sure it won't be allowed to scale).

[–] thebardingreen@lemmy.starlightkel.xyz 2 points 3 weeks ago* (last edited 3 weeks ago)

FBI: We've been gutted, refocused onto chasing immigrants and taking Tulsi along on politically motivated illegal search and seizure operations. Many of our experienced cyber people have resigned and many digital forensics teams have been reprioritized. So to protect the nation from cyberattacks (as we are no longer able to do effectively) we're launching a project with snappy branding to...

Encourage organizations to follow this handy list of well known cyber security best practices.

Some of those that wear badges...

[–] thebardingreen@lemmy.starlightkel.xyz 34 points 4 weeks ago* (last edited 4 weeks ago) (4 children)

This has been true since forever. As soon as people other than them want to carry guns, especially people of a different skin color, religion or sexual orientation, they are 100% pro gun control.

Exhibit 1: California, Ronald Reagan.

 

I've been thinking about this amped up conservative rhetoric that liberals and leftists hate America. We all know that's BS. Right? Except it's not, and we should respond to it for what it is.

"I love an America I grew up in. I love an America I believe in, that I lived most of my life in. Now, the idea of America that you're fighting and "winning" for is killing that America I live in, that I love. So you're right. I hate what you imagine America to be... because it is trying to murder the America that I love. And I don't use the word "murder" lightly, and I apply it to you. And if that means to you that I hate America... then you're right! The America you believe in isn't lovable."

That's all.

 

“violence and murder are the tragic consequence of demonizing those with whom you disagree” Trump said unironically.

 

Linking to the r/denver megathread ONLY because it seems to be the best source of updates right now.

 

This is a really insightful and disturbing article.

Sobering thought: What are we supposed to do about 60 MILLION fucking people in this country who genuinely believe that Jesus is coming back any day to reign as an absolute monarch and punish the non-believers for their lack of faith and that this is a GOOD THING? No wonder democracy itself is crumbling. How are you supposed to have a functional democratic alliance with people who are praying every day for their literal god king to come reign over the earth and who eat up the bullshit of ANY and EVERY conman and grifter who feeds into that?

 

I'm just asking questions.

 

I know, he's always been one of those conservative old men writing for teenage boys. That's been true since the 80s. But his themes on a number of subjects got just enough more progressive as time went on, and I was able to stomach his writing. I always pegged him as a centerist who moved VERY GRADUALLY leftward over the decades and mostly wasn't interested in making political points in his books. Though he clearly had regressive opinions about women in the military for a long time, especially when that was a big part of the cultural zeitgeist in the 90s, those even eased in recent decades.

On the subject of abortion, he wrote an impressively nuanced short story back in the 90s about abortion and telepathy. Specifically, about a telepathic scientist caught between pro life and pro choice political blocks trying to use telepathy in an objective way to answer the question of how human fetuses were at different stages of development. While the results initially seemed to favor the pro life crowd, at the end it's revealed that the story is more about the observer effect and that rather than reading the minds of unborn children, he was reading his own mind reflected back to him by developing brains unable to process the telepathic contact.

So I was surprised by just how moralistic and aggressively pro life Judgement at Proteus (the latest installment of the Quadrail series) was.

A major plot point in the book is that a teenage girl, pregnant through SA, turns out to have a

warning! spoiler!gene modded fetus implanted in her by would be alien conquerors who arranged her assault as part of a program to make human beings susceptible to their mind control abilities.

At multiple points in the story, the health of the fetus comes up and multiple characters go out of their way to say things like "all sentient life is sacred." The main characters express agreement with this sentiment, even while bringing up that on some parts of Earth, it would be legal to abort the fetus. The aliens running the hospital space habitat they're on shut that down quite aggressively.

The girl herself, who is shitty and antisocial to everyone to the point that she loses believably as a character, is shown to want her rape baby to live (at least until the truth about it's conception is revealed) in a way that makes her even MORE unbelievable as a real person (I've done a lot of professional work in my life with teenagers and I just don't buy it).

But then when she DOES change her mind about wanting to keep the baby she risks her life

warning! spoiler!trying to abort by getting drunk to the point of life threatening alcohol poisoning.

This is the most believable part of the story (and where I threw the book down due to the toxic bullshit) because:

  • A teen girl nearly kills herself doing something dangerous because she doesn't think (with good reason) that the adults around her will support her in getting an abortion? 100% believable.

  • The main character initially thinks she's trying to kill herself and calls it "murder." When he figured out what she was actually trying to do, he puts it that "she wasn't the intended victim."

  • A female character, shown to be in a supportive role toward the girl, expresses she can't understand why. The male character mansplains to her "put yourself in her shoes, you might feel the same way!" And she passionately rejects that she would not. Yeah, a woman thinks about being a teen girl, pregnant through assault, discovering she's carrying an alien cuckoo baby, "doesn't understand why the girl would want to kill her child??" In fact, she needs a man to explain this to her? Bullshit! Also, r/menwritingwomen. Pro tip: Would have been MUCH more believable if you'd written the same dialog the other way around.

  • The male character then councils the woman that their job is to "be the girl's friend and help her understand how it's the fault of the people who did it to her and not the fault of her unborn child."

And that's the point where I threw the book down. And realized I'm probably done with yet another author teen me loved who adult me just sees more clearly.

But I worry for the teen boys who ARE still totally reading this author (and other military adventure scifi by conservative old men sneaking their political agenda into it). Given his association with Star Wars, he's STILL a pretty big draw for the teen boy demographic and his latest books are clearly still aimed straight at them, where these ideas can go percolate with all the toxic shit they absorb from the Man-o-Sphere on Tik Tok and Youtube.

Damn! Just had to get all that off my chest.

 

No spoilers for Season 2 other than the magic is back and go watch it.

It's so good it makes other Star Wars almost unwatchable by comparison.

I'm also really inspired to go fight some fascism and blast some ~~space~~ Nazis.

 

Title says it all. I'd like to host my own instead of sharing mine and everybody else's schedule with some techbros.

 
 
view more: next ›