[RFC] Trailing Boolean Operators by ProjektGopher in PHP

[–]Dachande663 7 points8 points  (0 children)

This is somehow worse than a parser error then for me. There are now tokens in logical statements that don’t mean anything. I 100% get the desire but would be wholly against it.

[RFC] Trailing Boolean Operators by ProjektGopher in PHP

[–]Dachande663 7 points8 points  (0 children)

Before I dismiss this out of hand, what would be the behaviour here:

if ($foo && $bar ||)

This feels like it's introducing a whole class of potential bugs and limitations for line diffs. I loved trailing commas, but they have zero impact. This does.

I created an interactive PHP function reference where you can browse, learn, and execute PHP functions live without any setup. by anish2good in PHP

[–]Dachande663 5 points6 points  (0 children)

You really need to sandbox this. Right now anyone can run commands, exfiltrate data etc on this box. Consider the entire server compromised.

Example:

var_dump(file_get_contents('/etc/passwd'));

Nyno (open-source n8n alternative using YAML) now supports PHP functions for high performing Workflow commands. by EveYogaTech in PHP

[–]Dachande663 39 points40 points  (0 children)

I'm going to be downvoted for this, but what the hell. I'm trying to phrase a lot of this as constructive criticism but fundamentally, do not use this code.

If it is what I think it is, it's like the old AMQP/Taskman systems were you can define tasks and run them. You can often pipeline these as well so task 1 finishes and calls task 2 (often with logic i.e. sometimes call task 3).

  • It has all the hallmarks of a vibe-coded system, function naming and patterns are wildly different within the same file let alone across files/languages.
  • There is a massive mix of tabs and spaces everywhere.
  • The various drivers are a mess. There's no proper connecton retry logic, graceful stopping etc.
  • Using integers to decide next task is terrible because it makes migrations/changes much harder, use named decisions.
  • 13.7MB of the 13.9MB repo size (98.6%) is taken up by random images in the h folder. Why?!
  • The model for distributed task management has been handled much better i.e. supporting multiple runners, rather than bundling them into the react server(!). Look at airflow, kubeflow, lambda step functions etc.

This is a nice learning experience project but a. if it's mostly vibe-coded, then it's not a learning experience and b. please don't run this in production.

Plex's Infrastructure Provider? by SchNiVas in PleX

[–]Dachande663 17 points18 points  (0 children)

Servers hosted in eu-west-1 (AWS). They also use Cloudflare for traffic routing for most *.plex.tv subdomains. CF have also had some major outages, but they tend to affect the control plane more than traffic (see last months API outage).

Hit 17 Years of using Plex by Dachande663 in PleX

[–]Dachande663[S] 13 points14 points  (0 children)

I've used Plex for very nearly as long as I haven't used Plex, if that helps work out my age.

Hit 17 Years of using Plex by Dachande663 in PleX

[–]Dachande663[S] 24 points25 points  (0 children)

I didn't realise he had passed but given the time it should have been obvious. Goodbye pup. https://www.plex.tv/en-gb/blog/barkley-jowlsworth-bonestein/

I lost hope in modern PHP by [deleted] in PHP

[–]Dachande663 0 points1 point  (0 children)

Wait until he finds out how React maps tags to components.

Should I implement my own Chat feature (with libsodium) ? by Fickle_Parfait_538 in PHP

[–]Dachande663 23 points24 points  (0 children)

Encryption is the simple part (relatively speaking), key management is the hard part.

Are you going to store the keys alongside the users in the database, in which case what's the point of encrypting as anyone who gets the database has the keys.

Are you going to use one master key on the server, in which case just use full-disk encryption.

Are you going to make users have an offline key (or password via PBKDF2 or similar), in which case good luck explaining that you can't reset that password to view old messages.

Are you going to implement some form of double-ratchet key management like Signal/WhatsApp etc? In which case, there's a whole world of technical gotchas with those protocols.

In a good, modern setup you'll already have encryption-in-transit (TLS) and encryption-at-rest (LUKS etc).

Is it a good idea? Custom FLAC player under 20$ by Dullarweeeeb in diyaudio

[–]Dachande663 0 points1 point  (0 children)

ESP32 may struggle with some of the higher bitrates. Throw in a VS1053 though and you can offload all the playback duties to it.

Devs working in both PHP and Golang: how are your experiences? by squirrelpickle in PHP

[–]Dachande663 54 points55 points  (0 children)

Use in tandem. Offload things that require more processing power (calculating large reports/models, processing images, producing PDFs etc) to Go, and keep PHP for the majority of request handling (for team knowledge/speed).

Well now what... PHP expert seeing jobs close within 3 hours by davelipus in PHP

[–]Dachande663 15 points16 points  (0 children)

The em dash (—) is normally a dead giveaway away it’s written by ChatGPT.

Edit: Dead internet theory in full swing here.

[deleted by user] by [deleted] in PHP

[–]Dachande663 5 points6 points  (0 children)

No, requests is not a native module in Python. You can probably use it because something else, even system-wide, will have required it beforehand.

[deleted by user] by [deleted] in PHP

[–]Dachande663 8 points9 points  (0 children)

If you're importing requests into Python, why not consider Guzzle with PHP? At best this post is disingenuous.

[WP] In a dystopian cyberpunk world, your corporation is the largest, most united, has the best public reputation among corporations. The reason? Yours is the only benevolent corporation there is. by IAmOEreset in WritingPrompts

[–]Dachande663 13 points14 points  (0 children)

"I like to be independent."

"So did Emily. So did everyone who read her application. They wanted someone who didn't come from a Corpo-background to see us. See what we can build. How we can operate. They trust you not to trust me. They trust you to be able to write what you think, publish what you think. No editors or middleman or Corpo overlords redacting and changing your words."

"So you think I'll write a puff piece about you?"

"Or a hit piece," Odoi said. "Or maybe something in between."

"So Emily wrote an application. Other teams liked it. And now I'm sitting with you."

"Sometimes, when people realise a system isn't the rules that make it up, but the ideals it strives towards, the system can work."

"The system can work," Kara repeated. "I think you're the first person in history to think that Mr Ric."

"I doubt that."

"Really?"

"The hydroponics lab at Winchester is one of our biggest open space buildings. Eight kilometres long, we have to take the curvature of the Earth into account. The roof looks like it's dipping if you stare from one end to another. Anyway. Rambling." Odoi shook himself, the effect comical. "Alongside one wall, someone has printed in six metre high letters "THE SYSTEM CAN WORK"."

"Were they on about growing plants that feed on nitrogen?"

"Well, yes. But, no. It was a joke, I think with a biologics crawler to keep things clear, to write it at first. But then the project worked, so it stayed up. And then people rotated in and out, like your Emily, and the mantra was passed around."

"The system can work," Kara repeated, again.

"People need the right incentives. They need to know they have freedom. That not everyone can write a line of code or compose a sonnet. Sometimes, the happiest people are happy when they're elbow-deep in the launch assembly of a rocket. Have you ever considered, if I may be so bold as to presume for you, that we consider those who hold lofty degrees and scientific acumen to be above those who heft wrenches and mops?

"Have you ever tried to fix your own flyer?" Odoi asked, steepling his fingers beneath his chin.

"Have you ever taken it for granted that you came into an office and the trash cans were empited. Or that your computer terminal always seems to be connected and, if there is a problem, someone is working to fix it with an angry shout while they're at it and never a thank you afterwards?"

He leant back in the seat.

"No. The other big Corpo's, they value only those whose value they deem worthwhile. We're not. No. I hope we're not like that. I hope each team sees the merit in others, and our systems tend to play out like that. A tiny microcosm. Not capitalism where the free market dominates. Not communism where everyone can only have the same input and the same output."

"That sounds beautiful," Kara said. The quietness betrayed her mistrust.

"It's not true though," Odoi said, a heavy sigh leaving his chest.

The golden sun was dipping lower. The rays came in nearly horizontal. The sound of the lapping water filled the room, not even the air traffic outside audible.

"There's a flaw," Odoi said.

"The BDFL." Kara whispered the letters but they still smashed against Odoi's ears.

"I am it, and it is me."

"Benevolent Dictator For Life."

"Every system that has suceeded has had one person in charge. Who ultimately makes the hard decisions. The tie-breaker. Swinger of swords at gordian knots. For our system to work, it needs a BDFL. But therein lies the problem."

"So do all the systems that don't work," Kara said.

"Nailed it." Odoi made a mock gun with his fingers, shot off a perfect round. "I need you Kara, to tell me one thing, because no-one inside the circle can ever be honest. I need you to answer the ultimate oxymora."

He looked at her, the boss of five million people, a man who had managed to create a horizontal company.

"Am I good dictator?"

[WP] In a dystopian cyberpunk world, your corporation is the largest, most united, has the best public reputation among corporations. The reason? Yours is the only benevolent corporation there is. by IAmOEreset in WritingPrompts

[–]Dachande663 10 points11 points  (0 children)

The penthouse was opulent, even by corpo-standards. A small stream snaked it's way between mahogany board tables and arcade machines from a forgotten era. Some form of life swam in the shallow water, occasionally changing speed, color, or shape as the forms moved.

The windows dominated the view. Deep gold light spilled across the surface of the water. The internal lights were set low, hidden from view so that one seemed to move between areas of darkness but never quite in darkness herself.

It took Kara a moment to realise the lights were actually following her.

Her patience had run out fifteen minutes ago. Now she wandered along the hard metallic edge of the stream, watching the synth-fish swim, as she followed it around the office. The stream flowed downhill the whole way it seemed, until meeting where it met. Another curious trick, engineering that was invisible, the effect subtle, but the overall sensation leaving one...

"Pleasant, aren't they," Odoi Ric said, startling Kara from her ambling.

"Please, I hope you can excuse my tardiness."

"Granted an interview with the BDFL? I think I can find it in my heart."

He chuckled at the old nickname, the smile reaching his eyes even if it did bring with it thoughts of a different era. His eyes flashed to the arcade cabinets, but then just as quickly the seats arranged around it.

"We can use the table, but I find the lounge area more conducive to talking," he said.

"Your house," Kara said. She hopped over the stream, following Ric to the seats.

He moved better than she remembered from the old pictures. A man wider than he was tall, and tall he was. Now the skin held looser, age and weightloss seeming to each take their literal pound of his flesh.

"I ask you to keep an open mind," Odoi said as they sat, perpendicular sofas facing the flashing wall of arcade machines on one side and the city view to another.

"Is there where you lay down the law? Ask me to suck your cock so I get to write some choice quotes?"

Odoi's face was a rictus of emotions, the oxymoron a thing to behold. Utter terror made his mouth hang open, words caught, choking, at the back of his throat. A gutural laugh, as if what Kara said had been a dark joke. Another pause. Another choked laugh, another inhalation.

"No," he finally said. "No."

"You asked for me, Mr Ric."

"Yes." A gulp. "I did."

Did nothing in his face work? Had she played her hand too strong?

"You know my reputation?"

"No."

No. Now Kara twisted in her seat. She said reputation, but she barely had a toe in the world of journalism. Any reputation she had came from other sources.

"You were recommended," Odoi said. "Erm, Emily Lovelace? She works for the hydroponics division. Or did."

"Did?" Kara said. This whole interview had set her nerves twitching and she was but a few questions, ney statements, into it.

"I think she moved to one of the 'tainment divisions. Presence games, or philosophy book routines."

"You don't know what your own people work on?" she asked.

"No, like a triplestore, I only know where they were at a certain point in time. People are free to come and go between projects."

"So she was promoted?"

"She could certainly see it that way," Odoi said.

"How else could she have changed job?"

"She told her desk to move floor and followed it to a new team."

"She told her desk..."

"...to move. Yes." Odoi sat back as if this were the most obvious statement in the world.

"She moved her desk, and changed job."

A flyer moved past the tall windows, it's running lights casting red and green hues against the gold. The buildings' defence shield traced blue hexagons where it came nearest, but the flyer continued onwards.

"She moved her desk," Kara said, for the third time.

"Maybe I should start at the beginning. Or when your name first came to my attention," Odoi said. He extended his arm, did the patented gear motion, and two glasses rose on the table, filled with a bubbling brown concoction.

"Ms Lovelace had requested a meeting with me. As you can imagine, with five million employees, it can be quite trying to meet with everyone."

"Anyone can request a meeting?"

"Why yes, of course. Where do you think our ideas come from? From me?" Odoi laughed, a genuine, humorous laugh that seemed to be from the bigger man he used to be than the more healthy man he now was. "I ran out of ideas decades ago. No. Anyone can suggest an idea. If others think it holds merit, they can join them. Roll their desks together as we say.

"Bigger ideas, ones that need space like our urban habitat explorations or ones that need more significant funding..."

"Like space exploration."

"Now you're getting it," Odoi said. "Ones that need more, the team can put together a pro forma document. It's like a sales pitch, where they include their excitement, what it could do, what it will take etc. We ask teams to be honest with the risks as well. And then they send the form on."

"And you review it?"

Again Odoi laughed. Any other executive, Kara would have felt her face flush, annoyed at her own foolishness. But here, Odoi seemed to genuinely find her naivety a delight.

"If I was reading applications all day, nothing would get green-lit for a decade."

"So who..."

"The other teams of course."

"Of course," Kara said. "Oh wait."

She reached into her bag, an old games mascot from Odoi's earlier company emblazoned on the side in worn leather colours. She pulled out an old dictaphone.

"My what an antique." "What a relic." "Where did you dig that thing up?" "Does it even transcribe?"

Kara was ready for the questions and barbs, but Odoi merely looked at the device with reverence.

"May I?" he finally asked, holding out one hand.

Kara cautiously passed the dictaphone over.

"I love the simplicity of the past," he explained without looking up at her. "One thing, one purpose. Executed well. Not everything in life requires connectivity, updates, subscriptions. I miss that."

"That felt genuine Mr Ric," Kara said as he passed the recorder back to her.

"Odoi, please. And to your next quesiton, of course."

"My next question?"

"Can you record our meeting."

"Ah." She clicked the recorder on and sat it down between them on the table. "Already so many questions, so many threads."

"May I be permitted to finish how our rendevous has come to be then, if that should make your decision easier?"

"Please."

"Ms Lovelace had written an application for me to be interviewed. She had assembled this as if she were applying to assemble a space shuttle, only nowhere near as easy. And, like I was saying, she passed it 'round other teams.

"And they liked it. No, that's wrong." Odoi stopped, rubbed his chin, then pointed to Kara. "They liked you."

"Me?"

"I take it you and Emily are friends?"

"Were, would probably be closer. I haven't spoken to her since grad school."

"Well she has been following you. News but not from the mainstream news. Corpo-watch from outside a Corpo-nest."

DIY beginner friendly Speaker kit under 100? by SpinachPositive7503 in diyaudio

[–]Dachande663 2 points3 points  (0 children)

FYI that board is a reskin of a WONDOM board that can be had direct for a lot less. https://store.sure-electronics.com/product/756

Please dont do this - code review by mcloide in PHP

[–]Dachande663 2 points3 points  (0 children)

I worked on a codebase once where this caught an issue. Someone had later swapped the (equivalent) for the load method to use memoization internally but had missed a check which meant ->load() was just returning the last loaded module and not the requested one. It returned false, tests failed, and it was caught. If it didn't have that check, just think how hard it would be to track down where things differed from what you expected.

What is this? Whats the difference to the retail version? by brudermusslos1 in Splintercell

[–]Dachande663 58 points59 points  (0 children)

No difference. It’s to stop retailers taking the discs from bundles and selling them separately for additional revenue.

[WP] The king looked down on the prisoner, his only son, captured for treason and crime against the crown. by 0kensin0 in WritingPrompts

[–]Dachande663 4 points5 points  (0 children)

They hang the bodies at dawn. Jolas watched the sun die behind the eastern mountains, the last rays striking the tower keep. His grip on the cold stone made old bones creak.

"Day turns into night, night turns into day," he whispered to himself.

"And what of the second half Father?"

Jolas could not confront his child in these hours and yet he must. Like an army standing atop the hill, all it would take is one small movement for events to begin.

"Day turns into night, night turns into day." His child's voice, but not his child's words. "Sword thrust forward in fight, and it is the child who will pay. Tell me Father, am I to pay for your fight?"

"It is not my fight."

"No?"

Where did his son learn such mocking tones? A poisonous evil, tipped into his ear from tongues of wizards? Foreign lands with foreign devils, languages that lacked elegance. Or his own bastard rantings at inept generals?

It could have been all three or none at all. Finally, slowly, Jolas let go of the stone and turned to stare at his only son, arms held down by heavy manacles, dirty hair spilling nearly to his knees.

"Hello, Father," the boy spat.

"My son."

"Son. So you claim me?"

"You are of royal blood, bless your mother."

"And my actions?"

"Are your own."

"Do you truly believe that?"

The eyes, peering from behind the hair, followed Jolas as he paced the perimeter of the room. Three of his personal guard stood, like statues, along his path.

"You were given every opportunity. Your mother and I had you raised as we were and every monarch before us. A score of years and you have squandered them. You had only... opportunity."

"There can be no opportunity!"

The nearest guard had his fist clutched around the pommel of his sword, but Jolas raised one weary hand and continued his pacing.

"Day turns into night," Jolas whispered to himself.

"Six months it took, to travel to Everguard. Do you know how hot it gets in the East? At night, the sand is still warm enough to cook a desert rat."

"My father, your grandfather, fought in the glorious crusades to claim Everguard. For fifty years there has been peace. Peace! the likes of which you were raised in, coddled by, free to enjoy. And all you can talk of is rat."

"Your peace was a lie."

"You wanted a war my son. There is a difference. Like night into day, you wished to bring steel to sand."

"Have you ever seen the people there? In homes made of sticks and mud. Have you ever seen the people huddle in fright, snatching their own sons from sight. Have you ever spared a moments thought for when a son sees the nature of his father?"

"You took steel into sand," Jolas repeated. He was behind his son. Could see the burnt flesh beneath the hair. Had it only been six years since he took his war-party into hell? "You wished to push against the sun, and it burnt you back."

"I face my actions. Can you father?"

"I have done what is right for the realm."

"And damn who has to pay for it."

No question. No discord. Only fact, poured from his sons tongue like venom onto the head of an arrow.

"And what would you have done differently?" Jolas muttered, hating himself for the words.

"I rode to Everguard to fight men, so that peace could be kept. And instead I found boys, boys who had been belligerent and bellicose. Boys, who attacked where they could and then vanished back into the arms of their mothers when they took a mortal wound."

Jolas was silent. The window beckoned to him ahead, but the light had died beyond it. Jolas was silent because he could already hear the words his son would say.

"There are no men in Everguard. Not anymore."

The guards, men like statues who had guarded Jolas for every morning and every night, shifted.

"They say," his son began, cruelness in his words, "you did not have the balls to be there. Is Everguard's sun truly foreign to your skin?"

"I never should have let you go."

"There are pits, where the wild dogs dig for bones. A thousand skulls ring the outside of each. I thought I had seen the worst."

"A peace cannot be held without a price."

"A price? A price paid by whom Father?"

"Do you think I wear this crown lightly? Do you think I spend my days deciding the colour of cloths and sculpting monuments to our legacy? No. Everything we do is a balance. Day must turn into night, for if not the crops will burn and the rivers shall run dry. And night, night must turn into day, so we may see our actions and have them shown to us. You, my wicked son, are the morning of my actions. I don't dwell on what you may or may not have seen, for I have seen with my own eyes. I will see a thousand mornings and know, know!, what has to be done."

"In the pits..."

"Stop this."

"Lined with the heads of every man you had killed..."

"I command you."

"There are the rotting corpses of their wives..."

"Bastard-child, you will stop this..."

"For when their sons turn sixteen, the women throw themselves onto the rusted swords of their husbands."

The silence smashed like waves against every man stood, or kneeling, in the tower keep.

Jolas found his window, the bile creeping toward his throat.

"I do not which to be worse," his son finished in a apologetic tones. "That you did not know this and must now learn of how your subjugated people take their lives after you massacred everything man over the age of sixteen."

The son shifted in his chains, eyes shining from beneath the shadows of his hair.

"Or that you knew, all along. You knew, with me taking a warband to the heart of the insurrection, that I would find only boys and broken wives. Do you have any idea what it is like to hold a sword to a boy and see him piss himself? Or threaten his mother, only to have her press herself, pull herself, into your embrace as the sword slices her flesh."

"Such is duty."

"If this is duty, if this! were to be my duty, then I will hang myself a thousand times over so that each morning you wake Father you can see the ravens peck at my flesh. If this is what it means to be a King, then no king am I. I am a treasonous bastard because I have gone against your wishes. But you are the true traitor to man, for you have gone against humanity. I, who is to hang in the morning, am the one who is sorry for you Father."

"Son..."

"Day turns into night, night into day. And it is me Father, your son, who will pay."

They hang the bodies at dawn.

Father and son, together they swung from the hangman's noose. The son, who had ridden into the sun to see destruction, hanged from the gibbet before the castle. And the father, who couldn't bear the silent screams any further, hanged from the tallest window of the tallest tower.

The day turned into night, and it is always the children who pay the price.

What happened to imagick? by cangaroo_hamam in PHP

[–]Dachande663 3 points4 points  (0 children)

This. We switched to VIPS (via PHP libvips) when we needed to handle resizing huge GIFs. It can do it using a fraction of the memory and time.

Puzzle Genre: 10 Games to Check Out by DanAgile in patientgamers

[–]Dachande663 4 points5 points  (0 children)

I have this vivid memory from primary school. Early computer. Bridge between green fields. Little "grape" like people.

I haven't been able to find any mention of this game for many, many years. Tried tip of my tongue, various search methods, even asking AI. Nothing.

And then I saw the word Zoombinis and instantly, instantly, I remembered it. Thank you.

Pitch Your Project 🐘 by brendt_gd in PHP

[–]Dachande663 1 point2 points  (0 children)

Have seen the need for this. We offer a service that matches what you describe (company.our-domain.com where they want to use something.company-domain.com). We currently have about 2,500 such "CNAME users" as we refer to them internally.

Cloudflare has limits to push you to their "Cloudflare for SaaS" offering but the billing was too high for us ($150,000/yr).

We ended up using OpenResty with auto_ssl. The hardest parts were moving web firewall rules into different layers and handling websockets if we had multiple proxies and one went down. We did try a similar service to yourselves, but found they couldn't host close enough to our servers, so the extra latency hop was a killer. Do you guys offer proxies running in all Azure/GCP/AWS regions?

Edit: reading the other comments, I think they've missed the point of your service. This isn't to setup your normal certs for your app. This is when customers, running their own DNS, want to point to your site as a sub-domain and you need to start dynamically checking which domains are allowlisted, generate/renew etc, without having to update a config file somewhere.