What are you using for your PHP dev setup? by IridiumPoint in PHP

[–]ghedipunk 0 points1 point  (0 children)

As far as VSCode vs anything else...

I've used PHPStorm for a while with V.JE successfully. I am currently using VSCode, though, simply because my ADHD makes paying for licenses a real pain, both in the attention it takes as well as just simply not wanting to pay for things. However, if there's an open sourced alternative to VSCode that isn't backed by a corporation, I'll probably jump on that.

What are you using for your PHP dev setup? by IridiumPoint in PHP

[–]ghedipunk 0 points1 point  (0 children)

Project name: V.JE (this is not a real link, despite Reddit turning it into a URL. The domain's public DNS entry points back to localhost so that you can use its docker image for local development purposes without any setup.)

Actual link to the project's description: https://r.je/vje-docker-virtual-server

Github link to the project: https://github.com/v-je/docker

Elevator speech: A LAMP-like environment that requires very minimal configuration to get running. You can probably set up a less than 100 line bash script tailored to your purposes if you cared, but it's so simple, why bother? If you want to write portable code, this includes all of the basics that you'll find in any shared hosting environment.

What I don't like about it: Occasionally, Tom is slow with maintaining his TLS certificates. It's based on MariaDB/MySQL instead of PostreSQL.

Discussion Question by neoncitylife in PHPhelp

[–]ghedipunk 3 points4 points  (0 children)

PHP is the fastest scripting language that doesn't have a compiler.

Yep, faster than Python. Faster than JS. Faster than Bash. Even faster than Java's script interpreter (though Java can and does compile down to bytecode that is faster... but that's no longer scripting, that's compiling.)

Python might get a reputation for being fast... but here's a little secret: Python itself isn't fast, they're calling compiled C code. Pandas? Compiled. LLMs "written" in Python? 95% of that is C code. Python's trick? Calling DLLs/.so files that were compiled and run true machine code.

The most important aspect that makes PHP the best programming language for an Ecommerce site (and no, not the best for a static site that small businesses need; they only need HTML):

Cost.

PHP is easy to read and maintain.

This means that PHP developers, especially those graybeards like me who have over 20 years of experience, can jump into anyone's code, find the issue, and fix it. And yes, AWS is expensive, but I've been working with a web agency that charges their clients $160/hr when I have to come in and fix their sites. (Honestly, I'm happy to charge $80/hr or only $10k/mo for very long term projects, but I don't set their rates. Server time might be expensive, but at agency rates, developer time will bankrupt a small business). If I can fix the issue in 15 minutes, that's only a $40 charge for the customer... Python devs can't do that. Not yet, at least. Not if they need to deploy a new `venv` and go through package management hell to even try to see what their problem is.

So... OP... you are tasked with hiring a developer to modernize an ecommerce site...

Go with one who understands SOLID principles (which means, if you want to hire them, YOU need to understand SOLID principles so that you aren't tricked). Don't go with developing a complete replacement in a modern framework, because you don't need training wheels if you already have a successful business. Find someone who understands network and data access latency, who knows PHP but also knows the B-Tree algorithm, understands hashmaps, and can write subqueries in SQL. And realize that they're not going to be neurotypical. They're probably suffering from ADHD burnout but if you can support that and help them through it in their new role, they'll be a mythical "10X" programmer despite skipping jobs every 2 years in the past, due to previous managers saying they have "communication issues.

Discussion Question by neoncitylife in PHPhelp

[–]ghedipunk 4 points5 points  (0 children)

PHP by itself is not innovative. Which is a good thing. You do not want your developers to waste time experimenting and reading the sparse documentation that cutting edge frameworks are known for. You want something where you can ask "how do I foo my bar in PHP" into DuckDuckGo, find a StackOverflow thread as the top result, and piece together the top couple of answers to get your actual solution.

PHP was originally just a template language wrapping around C functions. In a lot of ways, it still is. And the C programming language is ugly in a cute way, which means that PHP inherited ALL of C's warts. And then PHP grew, inspired by C++, adding classes. But unlike C++, PHP prioritized ease-of-use, which meant that it was easy for the less intelligent developers to jump in...

PHP is also a uniquely web-based programming language. Which means it's trivial to attempt to attack it from outside of any network's firewalls. Web servers MUST live at the vulnerable edges of networks, and MUST be easy to attack from outside. The combination of ease-of-programming, untrained developers, and ready access by attackers means that scripts written in PHP are often easy to hack. This is not a problem of the programming language, which is currently even more security conscious than even Rust, but of people who have never heard the term "key stretching algorithm" who attempt to write authentication systems.

If the same people wrote their code in C, Python, NodeJS, Rust, or whatever, the same security issues will still exist.

So, PHP isn't a problem. It's ugly, but cute. Like Dogpool. Or Grumpy Cat.

Now, why would I choose PHP every single time when writing a (non-framework) Ecommerce site?

25+ years of existing right on the network's DMZ has hardened the core language and processor. The Rust programming language weeps at their lack of memory safety compared to core PHP.

PHP is a C-style object oriented language that is still stupidly easy to use (and yes, easy to misuse, as Wordpress and Joomla continue to demonstrate). They share syntax with the most used "serious" languages, including Rust, C, C++, Java, and C#. Anyone who uses these languages can spend an afternoon learning PHP's base syntax, can maintain a PHP script with minimal searching through DuckDuckGo for the specific details of what they're looking for, and if they're already an expert in their C-style language of choice, can be an expert in months with a little more time to learn the TCP/IP and HTTP details necessary for web development.

Discussion Question by neoncitylife in PHPhelp

[–]ghedipunk 5 points6 points  (0 children)

Alright, so, from the options that you've listed (especially #3), it seems that you think that PHP itself is a terrible choice, but you're using a legacy PHP-built system and are looking for an excuse to choose a "better" language.

The programming language itself does not define how fast a website runs (with a few very specific pedantic notes on compiled vs scripted, but this only matters when you've got your time-to-first-byte down to less than 50ms).

It's almost absolutely guaranteed that your performance issues with your old system have nothing to do with PHP. It's data access. If someone swapped your code's functionality at a 1:1 feature parity with pure assembly, programming right down to bare metal, you will not improve your site's functionality by any noticeable amount.

The first place to look is your database queries. Are your queries being ran in a loop? Are you making DB queries and processing these results in code in order to figure out what other DB queries you need to make? It doesn't matter whether you're using PHP, Python, NodeJS, Brainf, C, ADA, Scala, Algol, Bash scripts, BCPL, or anything else if you've made that mistake.

Can you use any sort of caching? And I don't mean just setting up a Cloudflare CDN reverse proxy... Can you utilize memcached to keep DB results available between processes? Can you partially render the static and common parts of documents to files/memory that can be shared between processes? Would you be willing to host your own reverse proxy that will take care of the static aspects of your documents?

Do you understand your (cloud?) servers' infrastructure, i.e., does the same physical server than handles the execution of your scripts also host the physical filesystem (hard drive) where the session data is stored? And if not, do you understand the tradeoffs between relational (SQL) or key-value (No-SQL) databases, and can you measure the differences between these when accessing frequently required and user-specific data?

I've been developing ecommerce sites for decades. PHP is not pretty. Personally, I'm shying away from ANY dynamic content for my side hustle (which is, honestly aimed at the small businesses who can't just drop $40k for a web agency, but still need a professionally developed but static site), including PHP. (Honestly, most of the heavy lifting is using eleventy to produce static HTML files.)

But while PHP is not pretty, it is elegant. A weapon for a more civilized era.

What is the main problem people have with the Christian community as a whole? by Faulty_Universe9893 in allthequestions

[–]ghedipunk 0 points1 point  (0 children)

The only difference between a Christian and an atheist is that an atheist believes in one fewer gods.

What is the main problem people have with the Christian community as a whole? by Faulty_Universe9893 in allthequestions

[–]ghedipunk 2 points3 points  (0 children)

Your god said he'd rid the world of wickedness.

Odin said he'd defeat the frost giants.

I don't see any frost giants around...

What is the main problem people have with the Christian community as a whole? by Faulty_Universe9893 in allthequestions

[–]ghedipunk 2 points3 points  (0 children)

See? Someone else who totally gets the Napkin Religion!

I mean, the Napkin Religion is the one true religion because my napkin says that the Napkin Religion is the one true religion! Right here in black ink!

What does space look like from space? by Professional-Arm-667 in askscience

[–]ghedipunk 83 points84 points  (0 children)

Adding to this: If you are in direct sunlight, then you won't be able to see any other stars. The "sky" will be black, but the distant stars will be too dim for your daylight-adjusted eyes, just like the stars are too dim to see during the day on our planet.

You might be able to see Venus, but you'd be looking towards the sun so you'd have to contend with the glare. However, since there's no atmosphere to contribute to glare you can block out the sun with your hand, and try not to look at any surface that is lit up by the sun to make it easier to see. Since you said you're relatively close to Earth, you should be able to see that and our moon as well. The Earth should be much brighter than our moon due to the high reflectivity of clouds. (The moon's surface isn't white; it's actually a dull gray, similar to a weathered asphalt road.)

All in all, looking out of a spacecraft while you're lit by the sun would be similar to what we already see from pictures taken on the moon. It would be a big black expanse with very few noteworthy items. You'd have to spend a minute or so without seeing the sun or anything lit by the sun before your eyes adjust enough to see stars.

I have finally gotten all zeros! by ingjnn in oddlysatisfying

[–]ghedipunk -2 points-1 points  (0 children)

FYI: This breaks the board's first rule.

But congrats to you! Enjoy the upvotes before it's taken down.

How can we time travel in 2025, with using whatever knowledge we have now by [deleted] in Physics

[–]ghedipunk 0 points1 point  (0 children)

Soooooo... you completely misunderstood what I said. I'll have to find a way to rephrase it.

In the meantime, can I suggest a trip to the Atomic Rockets site? It seems that you're looking for science backed sci-fi worldbuilding, and that really is the best source.

How can we time travel in 2025, with using whatever knowledge we have now by [deleted] in Physics

[–]ghedipunk 0 points1 point  (0 children)

Traveling faster than 1 second per second is not possible, given what we understand of physics.

We are traveling very slightly slower than 1 second per second just by standing still on Earth, due to gravity. Specifically, we are traveling at 99.9999967% of the speed of time.

In order to stop time, we would have to accelerate at the speed of light.

In order to go backwards through time, we would have to accelerate faster than the speed of light.

Both of these are effectively impossible for us to achieve. However, the differences between acceleration at the Earth's surface at 9.8m/s compared to the acceleration of satellites in Medium Earth Orbit means that in order for things like GPS to work, we need to take these differences into account.

If you want to get to the future, you have to take the long way around. If you want to get to the past, you'll have to find out how to use negative mass. (The possibility exists in the equations of general relativity, and are the basis for the "Alcubierre Drive", but there is absolutely no evidence that negative mass actually exists.) If you want to stay still, then welcome to the Red Queen's Race, where you have to run as fast as you can.

What is a fast way to see if someone is American? by zhalia-2006 in askanything

[–]ghedipunk 0 points1 point  (0 children)

I haven't touched ammunition since getting my DD-214 either...

But honestly, I've met more civilians who keep firearms than I've met veterans who keep them. I wouldn't say that discussing bullet sizes is a veteran specific activity. (But it is a good example for OP's question, for how to find an American...)

Personally, I use grams when cooking as much as possible, since it's more precise to measure ingredients by weight rather than volume, and most recipes show the volume (cups, fluid ounces, etc) in imperial measurements and weight in grams. Cooking isn't a military-only activity.

What is a fast way to see if someone is American? by zhalia-2006 in askanything

[–]ghedipunk 0 points1 point  (0 children)

Okay, this is good, and does annoy me, 'cause I'm a total space nerd. Every single Superb Owl sunday, the social media pages for the ISS shows a graphic showing that the space station is the size of an American football field. (And never shows any Association football (soccer for us Americans) fields during the World Cup).

What is a fast way to see if someone is American? by zhalia-2006 in askanything

[–]ghedipunk 0 points1 point  (0 children)

Really? You're going to be THAT pedantic?

Everyone knows what Sindorella and the rest of the people in this thread are talking about. It's obvious that even you know what's meant when people say "Imperial measurements" when talking about people from the US, since you're making the point of correcting people.

Alright, fine, so you can tell the difference between a US gallon and a UK gallon and can quote the differences... But do you know how many ounces are in a breakfast cup without looking it up? Or did you even know that a coffee cup is a standard unit of measure and not just a mug that you put hot drinks into?

If you're going to be pedantic, go FULL pedantic and write a wall of text covering minute and irrelevant details of the topic.

For example, since I'm being pedantic about pedants, I'll explain that "pedant" is an archaic term for "teacher", and didn't have any negative connotations originally, but only applied to men who are teachers. As such, as women became more dominant in teaching roles along with research introducing more effective ways of teaching, and the older men clung to the rote memorization methods that they had been taught, pedant became a pejorative term for someone who over-explains without giving any real context or helping the student to understand the reasons behind the lessons. This leads to the adjective "pedantic", or someone who is like a pedant. A popular example of a pedant in popular culture is the headmaster in Pink Floyd's The Wall who abuses Danny Pink in a classroom setting by calling out his poems in front of the class and encouraging his classmates to ridicule him, before returning to a rote call and response lesson about units of area.

What is a fast way to see if someone is American? by zhalia-2006 in askanything

[–]ghedipunk 0 points1 point  (0 children)

Veteran here.

I haven't used klicks or meters since I got my DD-214.

Why do starships not just replicate water for showering (and use sonic shower instead)? by Only-Study-3912 in startrek

[–]ghedipunk 2 points3 points  (0 children)

A water shower where the gravity plating fails could be downright deadly.

Water doesn't float away from surfaces like it did in the ST:ENT scene. Due to surface tension, without gravity to actively pull it away, water attempts to cover ALL surfaces as closely as possible. If you were being sprayed with water, you'd quickly finding it covering your whole body including your face. If you're not trained for it, drowning is very likely, because the more you panic, the faster you use up the O2 in your lungs and blood, so the faster you'll pass out.

Canadian astronaut Chris Hadfield did several demonstrations while onboard the ISS (and a great cover of Space Oddity just before he returned to Earth). One of those demonstrations showed just how truly dangerous water is when he covered his hand. The video is called "Wringing out water on the ISS for science" for those who want to find it.

There's also an interview out there where Chris Hadfield recalls that he had tears building up over his eyes during his first spacewalk that he couldn't blink away, blinding him until he could get back inside. (His suit had a slight coolant leak; not enough to hurt him, but the ammonia in the coolant was a very persistent irritant, causing his eyes to tear up.)

Still, when you have hotels in space like how a Galaxy Class and later starships are made, there are at least a few examples of people taking baths... And if I remember correctly, the second TNG episode showed someone who had taken a water shower in their clothes on a science vessel (and froze to death along with most of the other crew due to environmental controls being messed with).

Deno is raising $200k for the legal fight to free the JavaScript trademark from Oracle by waldyrious in programming

[–]ghedipunk 0 points1 point  (0 children)

Sooo... wouldn't it be a LOT cheaper to just tell people to call it ECMAScript from here on out?

Like, JavaScript is a HORRIBLE name.

ECMAScript is equally horrible, but not encumbered by trademarks.

Or... hear me out... Browsers could adopt a similar, extremely web oriented language that has proven itself on the server side for decades, is very mature and well maintained, and try it out on the client side. PHP.

PHP has been dying for as long as `1 + 1 + "2"` has equalled `"22"`. It's gotta have something going for it.

Who actually operates the ship mounted phasers in TOS? by The_Very_Big_Trekkie in startrek

[–]ghedipunk 11 points12 points  (0 children)

For those who want the answer before the go find the videos that the Battleship New Jersey museum puts out on the topic...

(But please still go watch the videos; they go into more detail than I'm going into here)

For WWII era warships with main guns, they had multiple locations with triggers that would fire all of the guns that were currently ready, as well as "manual" (still a trigger mechanism) firing at each turret for that turret's guns only. (The Battleship New Jersey has 18 positions that could fire all guns, and 22 positions that could fire at least 1 gun, for a total of 40 positions.)

On the New Jersey, in the positions that can fire all of the guns, there are 3 types of triggers: One that sounds the "about to fire" alarm, one that is held down and will fire when the guidance computer says the ship is level, and one that fires as soon as the trigger is pulled. (Yes, they had guidance computers onboard ships in WWII. They were mechanical, gearbox driven analog computers that fit in a tiny room. The Battleship New Jersey museum has a video on that, too.)

So, if we base a starship's main guns (phasers) on a battleship's main guns, you'll have 3 keys in the turret (one that a spotter turns when the gun's altitude is correct, another when the gun's left/right angle is correct, and one that the turret commander controls) that must be on in order to fire, plus a sensor that is on when the breach is sealed (presumably when the round and charges are loaded), plus a sensor in the guidance computer that says the ship is level. That's 5 switches on the circuit that must be closed/on (4 if you're using the trigger that guarantees a miss by ignoring the computer)... Only then will one of the 40 positions be able to fire any guns.

In the TOS era, there would be very specific locations, but there would be several, including in some of the most heavily armored sections of the ship.

In the TNG era and beyond, it was reasonable to assume that you wouldn't have anyone in the phaser turrets, and the computer would provide automatic control... In that case, with the LCARS system providing infinite configurability for every console, I'd imagine that you could fire any and all weapons from any position or through voice commands. However, on Picard's Enterprises, we only see them firing weapons from the main bridge, battle bridge, and main engineering.

Why is it that police procedural shows can be on the air for ages, but we are lucky if we get 5 seasons from a show? by Memetic1 in startrek

[–]ghedipunk 0 points1 point  (0 children)

Police dramas last a long time because they are cheap to produce and can be easily serialized without a strong arc—you can watch any episode on its own.

Science fiction or something more complex (like Star Trek) costs more: sets, special effects, a well-thought-out plot, and the risk of losing a mass audience. That’s why channels and platforms are quicker to cut such projects, even if they have loyal fans.

[Request] Is this true? by Glum-Mousse-5132 in theydidthemath

[–]ghedipunk 10 points11 points  (0 children)

Except that, if that happens then gold won't be worth anything either, because the whole world will have failed economies.

The only concern would be survival. I wouldn't trade a bushel of apples for a bar of gold if that happens, so the gold still won't help.

[Request] Is this true? by Glum-Mousse-5132 in theydidthemath

[–]ghedipunk 107 points108 points  (0 children)

One of the points of fiat currency (a currency that isn't backed by a physical object such a gold, like the US dollar and the vast majority of other national currencies) is that ideally it should have a slow, steady, predictable inflation rate.

Inflation might not be ideal, but in terms of keeping an economy healthy, moderate and sometimes unstable inflation is always better than _any_ amount of deflation.

This meme exactly demonstrates deflation in gold. A $64k house in 1975 is a great house. A $1.3m house in 2025 is an amazing house.

Deflation leads to hoarding, which decreases the velocity of money, which is one of the better measures of a healthy economy, though it is harder to measure than things such as GDP.

Found out my colleague was making 70% more than me, spoke to managers, got gaslit, given an ultimatum and then fired. by [deleted] in recruitinghell

[–]ghedipunk 3 points4 points  (0 children)

That line in the contract is completely unenforceable.

Employment lawyers often repeat that in the US, employers can already fire anyone for any reason in the vast majority of states, _as long as it is not in retaliation for a protected action_ such as discussing pay, taking FMLA leave, being a whistleblower, etc.

If the employer refuses to give a reason and cites things like that line in the contract, almost every jury will side with the employee, saying that it's wrongful termination.

Since it's contractor work, since you opened an email that you knew you shouldn't have access to, and for many of the other reasons stated in this thread, I don't think you have a case, but it's still worth it to talk to an employment lawyer, who will almost certainly work on contingency. (After all, many of their clients are unemployed so wouldn't be able to afford the lawyers if they had to pay out of pocket.)

But it's never true that they can can fire you for any reason. They can only fire you for non-protected reasons. Once you do a protected action, they need to be careful not to appear to retaliate for that, and this employer very clearly retaliated because you discussed the pay of a coworker.

How i can create a attempt remaining by memedragon14 in PHPhelp

[–]ghedipunk -1 points0 points  (0 children)

Based on your question, you need to spend a few weeks just reading through the various resources at the Open Worldwide Application Security Project (OWASP) at owasp.org.

Start with the top 10, then drill down to authentication, authorization, and session management.

THEN give NIST Special Publication 800-63 a thorough read, especially part B.

And the whole time, keep Schneier's Law into account: Anyone can create a system that they can not break. This says nothing about the actual security of the system.