The Bard in Green
- Technology Consultant.
- Software Developer.
- Musician.
- Burner.
- Game Master.
- Non-theistic Pagan.
- Cishet White Male Feminist.
- Father.
- Fountain Maker.
- Aquarium Builder.
- Hamster Daddy.
- Resident of Colorado.
- Anti-Capitalist.
- Hackerspace Regular.
- Traveler of the American West.
- 63 Posts
- 1.39K Comments
The Bard in GreenAto
Star Trek Social Club@startrek.website•Interview: Mary Wiseman On Tilly Settling In As A ‘Starfleet Academy’ Teacher And Dealing With Toxic FansEnglish
13·13 days agoAs someone who doesn’t usually connect with modern Trek, I’ve really been enjoying Academy and Life Of The Stars was one of my favorite Trek episodes of all time. Not many Trek episodes have made me cry like a little girl.
Disco was blessed with a bunch of very talented actors, but constantly plagued with terrible writing. It was lovely to see Wiseman on Academy.
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.
The Bard in GreenAto
Programming@programming.dev•I'm making a "pure" PHP site. The code works (mostly, still WIP), but I really feel like I'm doing a lot of "wrongs"English
2·21 days agoVery 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 “<div class=‘whatever-container’>”.$Page->pagecomponents[‘contents_of_some_html_file’].“</div>”;
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);
The Bard in GreenAto
Programming@programming.dev•I'm making a "pure" PHP site. The code works (mostly, still WIP), but I really feel like I'm doing a lot of "wrongs"English
2·21 days agoI don’t like reading it captain pedantic. Deal with it. :)
The Bard in GreenAto
Programming@programming.dev•I'm making a "pure" PHP site. The code works (mostly, still WIP), but I really feel like I'm doing a lot of "wrongs"English
2·21 days agoOn the one hand, you do have good reasons to use classes.
- Interacting with your database.
- Sanitizing your inputs.
- 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.
-
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();
-
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.
-
I’m assuming you might have something for each page like
include(‘header.php’);
<my page specific PHP is here>
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.
The Bard in GreenAto
Science Memes@mander.xyz•When DinoCon is doing more than the US GovEnglish
8·23 days agoHammond is 100% exactly the kind of guy who would have been to the island dozens of times.
Coconuts are tropical! This is a temperate zone!
The Bard in GreenAto
TenForward: Where Every Vulcan Knows Your Name@lemmy.world•Let's all have a Star Trek wash partyEnglish
6·29 days agoHow do reavers clean their harpoons?
The Bard in GreenAto
Science@beehaw.org•New York Startup Builds Fridge-Sized Machine That Can Turn Air Into GasolineEnglish
121·1 month agoDoesn’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).
The Bard in GreenAto
Cybersecurity@sh.itjust.works•Operation Winter SHIELD: FBI Issues Cyber Call to Arms - Infosecurity MagazineEnglish
2·1 month agoFBI: We’ve been gutted, refocused onto chasing immigrants and taking Tulsi along on politically motivated 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…
The Bard in GreenAto
Politics@beehaw.org•MAGA Is Proving How Little It Actually Cares About Gun RightsEnglish
24·2 months agoThis 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.
The Bard in GreenAtoUnited States | News & Politics@midwest.social•Fascist run out of Minneapolis while attempting to lead pro-ICE, anti-immigrant hate rallyEnglish
4·2 months agoKristi Noem wants us to stop saying the name of murderer Jonathan Ross.
Steve Rogers, when the monkeys flew.
The Bard in GreenAto
Science Memes@mander.xyz•It was time for T-Rex to leave, he had seen everythingEnglish
2·2 months agoOra Ora Get Pregnant.
The Bard in GreenAto
Science Memes@mander.xyz•It was time for T-Rex to leave, he had seen everythingEnglish
1·2 months agoBased on the narrative, I assume she’s a switch.
The Bard in GreenAto
Medicine@mander.xyz•Engineers design pills with biodegradable radio frequency antennas; could allow healthcare providers to know if and when a patient takes their medicationEnglish
1·2 months agoNo potential for abuse here, no sir.


















Now is an excellent time to make a donation to the Tor project.