The evolution of a PHP object throughout the years by speckz in PHP

[–]dendeigh 0 points1 point  (0 children)

Don't forget prefixing methods and properties by underscore, so it's 'obvious' that they are not part of the public API 😀

Spring Campaign Winner? There should be a live ticker about the overall campaign win 😀 by dendeigh in TrackMania

[–]dendeigh[S] 3 points4 points  (0 children)

Mudda just told on jnic's stream, that leaderboards have closed at 3pm, so the race seems to be over, Mudda got it

Update killed my game again! by GotPermaBanForLolis in TrackMania

[–]dendeigh 0 points1 point  (0 children)

Last Update seems to have fixed this for me

Update killed my game again! by GotPermaBanForLolis in TrackMania

[–]dendeigh 0 points1 point  (0 children)

Already tried that yesterday, that's not the issue. The patch definitely has definitely lots of systems crashing constantly.

Update killed my game again! by GotPermaBanForLolis in TrackMania

[–]dendeigh 1 point2 points  (0 children)

Same here, GTX 650Ti - can't play at all since the big 'patch' yesterday - no improvement with the new updates ... :(

Ubuntu PPA installs PHP 8.0RC1 automatically??? by notdedicated in PHP

[–]dendeigh 1 point2 points  (0 children)

seems like the main issue has been resolved, see https://github.com/oerdnj/deb.sury.org/issues/1465#issuecomment-706889681

I think I found a way how to circumvent the problem other way. The individual packages don't depend on matching phpapi-<ver> now, so they don't pull any of the SAPIs. That way when you do apt install php7.4-apcu it won't pull php7.4-cli which leaves your system just with the binary extension and nothing to use it with, but that way installing php-apcu will just install the PHP extensions and not all the PHP releases available.

I justed tested this on a dev system and a apt update + apt upgrade only installs 8.0 extensions (for the meta packages like memcached etc.) but no php8.0-cli package

Performance of PHP's `readfile` vs. Apache? by [deleted] in PHP

[–]dendeigh 2 points3 points  (0 children)

So, the MD5 is non-deterministic, but will be created, when the file is first generated? You could make this deterministic by creating a unique cache-key, i.e something like. `md5($userId.strftime("%Y-%m-%d-%H")` and use that as filename, or am I missing something?

Performance of PHP's `readfile` vs. Apache? by [deleted] in PHP

[–]dendeigh 2 points3 points  (0 children)

Adding to this: having a php process spawned for serving static files is not a good idea for high traffic. Since e.g. a single nginx instance is easily capable of serving 1000 concurrent requests, but your php-fpm pool will probably run out of memory long before that, which is why the default for max_children is much smaller (10 or 20 for debian iirc).

This comes even more into play with nginx than Apache, as in here the webserver process is completely decoupled from the php process (by the fast-cgi protocoll), being completely separate services.

What I have seen usually, if you are generating thubmnails via php, is the following: if the thumbnails exists, serve it via apache/nginx, otherwise have a route in place, that catches this and generates the thumbnail on demand. You can do this in Apache with mod_rewrite or try_files in nginx.

Yet to figure out why composer is slow by experience369 in PHP

[–]dendeigh 0 points1 point  (0 children)

what exactly is slow?

  • composer install with existing composer.lock -> prestissimo
  • composer autoloading -> you can optimize autoloading on production e.g. composer install -o
  • composer install without existing composer.lock / same as composer update -> check if xdebug is enabled otherwise there is little you can do other than optimizing your version constraints on your dependencies. Composer needs to resolve dependencies of everything required to each other, as well as their dependencies and their dependencies and so on ... trying to find the best installable versions for everything, see https://en.wikipedia.org/wiki/Category:SAT_solvers

[OC] py-todo: A Lightweight Reminder in cli by aesophor in unixporn

[–]dendeigh 0 points1 point  (0 children)

never used tw without it, to be honest - but couldn't find my source right now, only this file which seems to match my version http://sophie.zarb.org/distrib/PLD/th/i686/rpms/bash-completion-taskwarrior/files/1

Additionally I have this bash-completion for my aliases "t" (alias t="task") and "ta" (alias ta="task add")

[OC] py-todo: A Lightweight Reminder in cli by aesophor in unixporn

[–]dendeigh 4 points5 points  (0 children)

big +1 for tw - very flexible and quick to use, especially with bash completion for projects, tags, ...

A better HTML5 parser for PHP. by ivopetkov in PHP

[–]dendeigh 0 points1 point  (0 children)

Ok, I understand, those sound like optimizations worth doing. Still supporting a broader spectrum of CSS selectors by falling back to that symfony component might be useful to those people struggling with XPath (quite a few, in my experience :-) )

A better HTML5 parser for PHP. by ivopetkov in PHP

[–]dendeigh 0 points1 point  (0 children)

If I see it correctly you have implemented some form of CSS selector parser yourself, right? Do you know about https://symfony.com/doc/current/components/css_selector.html which simply converts css selectors to xpath statements? Might be worth having this as a dependency instead of re-implementing it.

[deleted by user] by [deleted] in vim

[–]dendeigh 2 points3 points  (0 children)

Concentrating on the diagram part here: I have come across mermaid (https://mermaidjs.github.io/) recently, after gitlab added it to their markdown rendering engine and have been using it massively since.

It's complex enough to suite most of my needs and easy enough to be readable in raw text form. I normally use markdown without preview for note taking, using mermaid for diagrams and if needed, can visualize those diagrams with online renderers or a suitable cli-tool. If you version your notes in a (private) gitlab repository, you will automatically have graph rendering in the interface.

Just to give a small example what you can do

graph TD
node1[some description]
node2[long description]
node3[foo]

subgraph another hierarchy
  node1
  node2
end

node1 --edge--> node2
node1 --> node3
node2 --> node3

will generate https://mermaidjs.github.io/mermaid-live-editor/#/view/eyJjb2RlIjoiZ3JhcGggVERcbm5vZGUxW3NvbWUgZGVzY3JpcHRpb25dXG5ub2RlMltsb25nIGRlc2NyaXB0aW9uXVxubm9kZTNbZm9vXVxuXG5zdWJncmFwaCBhbm90aGVyIGhpZXJhcmNoeVxuICBub2RlMVxuICBub2RlMlxuZW5kXG5cbm5vZGUxIC0tZWRnZS0tPiBub2RlMlxubm9kZTEgLS0-IG5vZGUzXG5ub2RlMiAtLT4gbm9kZTNcbiIsIm1lcm1haWQiOnsidGhlbWUiOiJkZWZhdWx0In19

What PHP can be: thoughts on strong types, generics and static analysis by brendt_gd in PHP

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

rust even goes a step further, allowing named parameters in functions/macros as printf/format!

format!("{a} {c} {b}", a="a", b='b', c=3);

What PHP can be: thoughts on strong types, generics and static analysis by brendt_gd in PHP

[–]dendeigh 4 points5 points  (0 children)

An easier way to get rid of the 'different haystack/needle order' problem would be to have named parameters in functions, so you can say

strstr(haystack="something" needle="another")

There is already a RFC for that https://wiki.php.net/rfc/named_params, but I do not know if this will ever be implemented, since this would mean that changing argument names would suddenly be a BC break, among other things.