Skip to content

u/oefd

In this archive from Sep 2018 to Jul 2022

0
posts
56
comments
0
media
221
score

I don't know, I'd investigate the outage.

Yes, how? Good ways to address that question would be clarifying what 'unreachable' means. If you were told that you see a browser page with ERR_CONNECTION_TIMEOUT or something some good things to say at that point

  • ensure DNS is correctly pointing at what you think it should be
  • check logs or otherwise ensure the service serving your site is up
  • try tracerouting the ip and see if traffic gets all the way to the server
  • if not: where does it end? Try and find out what router/ISP/whatever seems to be the last hop before traffic drops
  • try loading the page on a mobile data connection or through some other connection - is it still unreachable there?
  • try something like https://www.meter.net/tools/world-ping-test/ to see if it's an issue globally
  • if the issue is localized to your ISP you likely need to contact them. If it's localized to your personal connection it's likely a local network issue. If it's global it's likely either your provider is down, or your server is having the issue. If it's a broad set of ISPs/ASNs that can't connect, but others can or a broad geography is broken but not the rest of the world it's likely there's an issue in an IX or some transit provider that many different ISPs in a certain area rely on.

By answering with a slew of statements like the above you're proving to the recruiter you have an idea of the many failures modes that may cause a website to be unreachable, and demonstrating you have some idea of how to diagnose the issue.

The amount of failure modes you're able to come up with also helps indicate your level of expertise in the networking aspects. I wouldn't expect a fresh grad or indeed most devs to get to the point of trying to figure out if there are routing issues in the internet at large. If you know enough and give an answer indicating that's something you'd think about you're signaling to the recruiter you have a more in depth understanding about networking than someone who just says "I dunno, I'd make sure the DNS was right" and leave it at that.

2 points

Languages aren't secure or insecure, the apps built on them are. Languages often have features or defects that make it easier or harder to write a specific app in a secure way, but that's not the same thing. You can't just say "PHP is secure".

The same with 'fastest'. There is no actually useful metric in a general sense for how fast one language is over another. You have to have a specific application in mind to figure out what your speed bottleneck will actually be.

3 points

Most cPanels come with built in PHP support

Yes, but that sort of hosting has been on the decline for a long time too. It's also not going to disappear any time soon, but it's been getting squeezed hard by PaaS type offerings and even before that by VPSs that'll give you root access and let you do anything. (Which is good, because the idea of having hosting that doesn't support your framework is pretty crazy.

I meet a lot of casual/hobbyist/entirely new programmers as part of events I attend, and approximately 0 of them use (or even know about) something like shared hosting with a cPanel interface.

2 points

Been using python with this set up for a couple years now. Also been a user of typescript and ruby+sorbet, dabbled a bit in typing with PHP.

The python experience beats them all imo, and a lot of that comes down to the fact that typed python is legal python. No tedious build system to transpile things constantly, no tedious build system to maintain distinct type information files somewhere else.

1 points

Depends on the framework / set up.

In general (PHP or otherwise) you don't actually want everything to die at the end of a request cycle, you want everything contextual to that request handling to die.

Restaurants don't kill and replace the chef in between each meal getting cooked up, and for good reason. It's not only illegal, it's also painfully inefficient. You're better off with a system that makes it easy or enforces that some things (like a thread pool for the database) exists persistently, whereas request-specific things should be tied to the request life cycle.

PHP and other programming languages all have means of running that way. They also all have means of being run CGI style and doing only one-offs.

11 points

I'm going to start with what I think is the most important thing I have to say about this article:

Programmers are an opinionated lot. We’re arrogant. Get over it. We are.

...

Call me whatever nasty names you like, but it’s my goddamned code and I’ll write it the way I want and the rest of you PSR purists can go to hell. (See what I mean by opinionated?)

This article mentions, but does less than nothing to fix the arrogant and needlessly violent way of expressing opinion endemic to the field. Lampshading your arrogant and haughty to prove you're self-aware when you're doing it doesn't make it somehow cool now. That doesn't excuse the behaviour.

As for the actual content of the article:

It's been some time since I was last a professional PHP dev, but I keep up enough with things that, for example, I read /r/php. I'm in a similar boat with python - keep up, but it's not what I'm paid to do now and hasn't been what I'm paid to do for some time. From my time in both worlds: I don't get this article. The majority of python programmers never think about PHP because the majority of python programmers aren't web devs. I think most PHP programmers also don't spend much time about python except maybe if it's the language some utility they're using it written or whatever.

This article takes a really high-horse attitude about how all the haters are just following their religion and trying to be cool, then says of the criticisms of PHP:

PHP has too many functions. (Yea, that’s a thing with some people, it’s too convenient and does too much.) The function names are inconsistent. (Yea, that happens when a language is truly democratized as opposed to being written by one guy trying to earn their Ph.D in CompSci.)

Which is in the former example is a misunderstanding of why people that criticize PHP's global namespace function count do so, and in the later example is making some kind of appeal about how PHP is 'democratized' by comparing it (utterly incorrectly) to how other languages, including python, are developed.

Additionally the article is extremely web-focused even though web dev is just one field amongst many:

Interestingly enough, Python has been around since 1991, before PHP ever saw the light of day. But despite having an even longer runway, it failed to achieve the same level of adoption that PHP now enjoys.

Python has way more adoption than PHP has and likely ever will in a number of areas. The same is true in reverse - it's very unlikely python's ever going to unseat PHP in the arenas where PHP is currently more prominent. If you want to talk about web dev fine, but implying that PHP is "killing" python by looking at web dev is very tunnel-visioned.

You want to defend PHP against unfair or even fair criticisms of it? Cool. It's not hard. This article isn't that though.

78 points

RedHat/CentOS are the same operating system. RedHat is expensive and comes with tech support while CentOS is free.

Just an FYI that changed recently, and there's projects like Rocky Linux that are basically what CentOS was before.

1 points

True, but it'll take more effort. The goal of the FizzBuzz type question is to rapidly thin the pool of candidates by finding true negatives rapidly before moving on to 'real' interview questions.

To quote the article that popularized FizzBuzz:

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes.

Want to know something scary ? – the majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

...

This sort of question won’t identify great programmers, but it will identify the weak ones. And that’s definitely a step in the right direction.

0 points

Because they intend to keep python3. IE it will stay part of the base system because MacOS will continue to have python3 scripts somewhere in the OS.

Or at least: that's what it looks like given the warning in 2.7 explicitly says: "transition to python3", while PHP and ruby tell you they're just going away entirely.

1 points

They're wanting encryption of data in the DOM,

... What does that even mean? That the user can literally never see the content because there's only ciphertext on the webpage? Because I don't imagine that's what you mean, and obviously the webpage can't display plaintext without it existing in its unencrypted form.

I believe a lot of their apprehension is driven by attorneys that don't grasp the basics of how TLS works and how data flows through an application.

I understand that absolutely, but implementing extra needless security that can arguably make things worse security wise by complicating things doesn't seem like a great solution.

Draw them a diagram if you must, explain that when they enter their password on any website the code on the webpage can see and read their password just fine, and that password can be transited across the network just fine with TLS. Maybe even do a demo using postman yourself showing that even big tech companies have APIs that 'expose' private data because those APIs trust TLS to provide all necessary security in transit.

If they're the ones that said they want 'encryption in the DOM' explain that isn't a concept that makes sense in the same way it would make no sense to ask lawyers to keep the text of a legal document encrypted while still allowing a human to read it - encryption is for data at rest and in storage or during transit, not for something a you're trying to read right now.

If they categorically won't accept it I wouldn't want to do business with those clients because my only options become lying to them and hoping they don't notice I only pretended to meet their demands or lying to them by pretending my roundabout 'security' is helping somehow.

1 points

Even after informing them that SSL solves those problems, they want data encrypted in real-time in the browser before it's even communicated to the back end and vice versa (to prevent MITM viewing in every possible way...

Which is exactly what SSL/TLS does. Maybe you already knew that, buy maybe you're not familiar with how TLS works and just know it 'solves the problems'.

If you don't know how TLS works: they're asking you to re-create what you're already getting from TLS. Its encrypted communication with the encryption carried out using an eavesdropper proof key exchange mechanism, it includes reasonable verification of the identity of what you're connecting to, and if you implement it carefully you can even get perfect forward secrecy so if someone steals the private key tomorrow it doesn't mean today's communications can be decrypted.

I'm not sure what features of Airship you're hoping to use to satisfy their demands, but I can guarantee that at best you'll match what modern TLS gets you for in-transit encryption minus the verification of identity provided by TLS certificates.

and to prevent non users from seeing data in the browser dev tools or through something like Postman when endpoint trolling).

If you're talking about clients that can't or won't understand TLS do you really need to be worried about this? You could probably just base64 encode your data so it isn't 'visible' to humans and use TLS to get the actual security they want... But in your situation I'd just consider whether I really want to work with people that insistent about technical details they don't understand but believe they do if I were to tell them TLS does everything they want and more but they insisted on something else.

3 points

Why are you sceptical of clock speed? If you're well set up for using all the cores why look for more clock speed instead of more cores? Do you have some sort of profile that defines what the performance problem is (is it a long time to first byte, slow transfer speed, a lot of dropped connections)?

Do you know what part of the executing code is the bottleneck in any case?

Without knowing the above you can't reasonably indicate how to fix it, but in any case: more clock speed is unlikely to be the right answer. Needing more CPU cores or just more servers running more CPUs entirely may well be.

1 points

Never done it in PHP but sounds like you'd want a streaming JSON encoder which lets you submit the data in fragments rather than having to commit the entire data to RAM, then the entire encoded object to RAM as well.

In fact what you've done if you're manually stitching together smaller json encoded fragments is basically a just a poor man's implementation of a streaming encoder.

2 points

I'm not going to comment on the quality of existing PHP LSP implementations because I haven't used any much at all, but in the general case the magic of LSP which integrates into vim just fine offers you refactoring help, inspections/intellisense/intelligent-autocompletion or whatever you want to call it, and automatic formatting. That's pretty IDE like, and it takes 1 plugin + installing the LSP server. If you use something like spacevim which was linked which installs, configures and integrates all the develpement envrionment tools for you out of the box, well that's even more IDE-like.

If you prefer a 'real' IDE that's fine, I'm not trying to say vim/spacevim is inherently better for having this support (and I don't even like spacevim to be honest), but saying it 'will never be an IDE' isn't terribly fair if it's not only possible to take a bunch of tools and integrate them all into the editor, but someone already did.

1 points

What if you want to lock down certain endpoints to a the local 10.128.0.0/16 network exclusively, need to run one php project to handle foo.example.com and a different one bar.example.com but you have a static site for baz.example.com, and need to run some python uwsgi app for foobar.example.com, and yet another admin.example.com but that one should only be accessible to clients connecting via the VPN network the server's on, and you want to automatically 301 redirect all connections to port 80 to https except for requests matching the path /.well-known/acme/*?

All of these things can be done by a web server like nginx, and all of these things are an example of the kind of rules that some people really need support for, and yet simultaneously some people absolutely would not want them.

That's why web servers are so big and complicated - dealing with all incoming web traffic is a bit of a big deal because a web server is the primary junction between the internet at large and a bunch of other things on an internal network for a lot of machines out there. Being up to the task of dealing with that is a huge project in its own right.

The PHP devs would either have to

  • spend years making a good-enough web server that'd still probably be inferior to nginx or haproxy anyway
  • require you use a reverse-proxy in any non-trivial case anyway
  • or what they actually have done: build a toy web server good enough for local testing but never meant for actual use in production

not to mention if it's a more modern design make it more secure ?

More modern how? More secure how?

In fact it'd almost definitely be less secure since you're now making any exploit of the PHP code perhaps be able to exploit the web server as well and vice-versa if you integrate the two together, not to mention the fact that nginx, haproxy and others already have the benefit of extensive testing.

1 points

/u/phordikj spent time at no charge going through code, pointing exactly where there's an issue, and indicating an easily-searched set of terms to find out why he's taking issue with that code. The fact they didn't also go to the extra unpaid effort of explaining what you can find readily with a search engine doesn't count as a negative in my mind.

Certainly if you're talking to friends or even coworkers a bit more care should be taken to be gentle and friendly, but that's not what this is: it's someone asking the world at large to 'take a few minutes and provide feedback'.

If the feedback is just "uniqid is broken, don't use" fortunately it's easy to find out from the official docs why it's broken. No need for someone already providing advice for free on their own time to do the work of paraphrasing that for you.

Similarly you can search "html regex" or "float for money" and find plenty of explanations of why they're bad ideas, and alternatives.

The feedback isn't constructive per se, but combined with basic web searches it's incredibly informative. Either the OP didn't know about some of these issues already, in which case them looking up and reading why, say, html parsing can't be done reasonably with regexes is something they should do anyway, or else the OP does understand why, say, email header injection is bad but just sort of derped out and wrote vulnerable code in which case the OP benefits from just being told "the email stuff is vulnerable to header injections."

9 points

More specifically: this would mean that the PHP syntax would need to become a superset of C syntax, and a PHP parser would necessarily require a C parser.

1 points

My current installation dates back about 4 weeks. I tend to end up reinstalling compulsively out of an irrational sense of hygiene every couple months.

On the upside: it's a great way to make sure you keep your backups up to date, and you end up learning a lot of nifty things when you're trying to redo them and find out that in verison whatever thing whichever supports a better way of doing something.

2 points

If you're wanting to feel cool you can implement it as an infinite iterator. Ex:

<?php

function one_to_four() {
    for (;;) {
        yield 1;
        yield 2;
        yield 3;
        yield 4;
    }
}

$iter_count = 0;
foreach (one_to_four() as $value) {
    echo $value . " ";
    if (++$iter_count == 5)
        break;
}

which will output

1 2 3 4 1
2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.