rikudou

joined 2 years ago
MODERATOR OF
[–] rikudou@lemmings.world 3 points 9 months ago (1 children)

The president was never inappropriate with anybody

If that doesn't show she's just bad at lying, I don't know what does. That idiot has been inappropriate with people live on TV.

[–] rikudou@lemmings.world 6 points 9 months ago

Well, yes, as all birds are.

[–] rikudou@lemmings.world 2 points 9 months ago

Fear is important for us. And your brain mostly prefers fear that can't harm you.

[–] rikudou@lemmings.world 2 points 9 months ago

It's no surprise that North Koreans fall for the propaganda, but seeing it here is surprising.

[–] rikudou@lemmings.world 2 points 9 months ago

Nice! If anyone's curious about php:


strlen("🤦🏼‍♂️"); // 17
mb_strlen("🤦🏼‍♂️"); // 5
grapheme_strlen("🤦🏼‍♂️"); // 1

[–] rikudou@lemmings.world 3 points 9 months ago (2 children)

So nothing really changes? Fire OS is Android.

[–] rikudou@lemmings.world 13 points 9 months ago

I got fired for disabling our company VPN too often. Made me chuckle once I woke up.

[–] rikudou@lemmings.world 5 points 9 months ago* (last edited 9 months ago) (2 children)

For your first paragraph: yes, exactly. For software you distribute in binary form to customers, GPL and AGPL are effectively the same thing. For SaaS you can easily use GPL and not share your source code. Though beware if your ever need to deploy your SaaS on the customer's premises.

The point of these licenses is to not restrict user's rights, so LGPL doesn't want you to use their code and not let the user do whatever they want with it according to LGPL. So if I create an app and decide to not maintain it, you're still able to pull bug fixes etc. even without my involvement.

Yes, GPL effectively makes your binary GPL as well. And if you provide a library for others using GPL code, projects using your library must be GPL-compatible as well.

But the point is that you cannot restrict the user's rights, so if you distribute the source code you can choose a more permissive license (like MIT) for your code. That could in theory mean that if someone finds a replacement for your GPL dependency and remove it, they could release it under any MIT-compatible license (which is just about anything).


GPL dependencies are often avoided in companies because of its spreading nature where it makes everything it touches effectively GPL. And even if you write SaaS, if you're B2B you'll eventually land a bigger customer with strict software policies and you'll have to deploy on customer's servers, thus having to legally distribute the source code as well.

You don't have to provide it automatically, but shall they ask for it, you have to deliver. And relying on the customer never asking is not the best business decision. See for example here: https://boehs.org/node/truth-social

[–] rikudou@lemmings.world 5 points 9 months ago (2 children)

And the millennial generation is truly millennial.

[–] rikudou@lemmings.world 22 points 9 months ago (5 children)

GPL = whenever you distribute software which contains GPL code or libraries, your code must also be distributed as GPL or compatible. V2 vs v3 differences are mostly in v3 clearing up some ambiguities.

AGPL = same as GPL, except it applies even if you simply provide your code as a network service

LGPL = same as GPL except it makes it possible to distribute closed source components (or with incompatible license) as long as the user is able to replace the LGPL libraries.

MIT = you can do whatever with the code

So, GPL only concerns you if you distribute your application as a binary to users, think like Photoshop or Microsoft Office. Your code is effectively GPL even if you don't distribute it, but there's no requirement to make the source available to everyone, only to those who you distribute the software to.

With AGPL even having the application accessible over the network is considered as distribution to users. You basically cannot have an effectively closed source application with AGPL.

LGPL is usually used with dynamically linked libraries where you can distribute your application easily as long as user can replace those. For example Qt is LGPL and you can sell your app without providing source code as long as the user can replace the Qt framework dll/so libraries.

And with MIT anything goes, you can use it in a closed source product, in fact of those four it's the only one that allows you to have a truly closed source codebase.


As for how they're compatible, the most strict license usually applies. All of these four are compatible to some degree, but you can't simply take a GPL code into a MIT codebase and make it more permissive suddenly.

Your code can be MIT, but the original still is GPL. Meaning that when you distribute the application, it's effectively GPL. Same with all license combinations.


As for why would you choose one or the other, it's pretty much about how much you want your users to give back.

With GPL, you want any modifications to be able to be included in your project. With LGPL as well, but you're not forcing people to open source their whole app, only direct modifications to your code. With AGPL you're basically forcing everyone to open source their app if they use your project at all. With MIT you don't care at all, you just give your code to the humanity to do whatever with it.

[–] rikudou@lemmings.world 2 points 9 months ago (1 children)

Does it need to be that specific tld? There are plenty you can use, like .eu if you're from eu, or .dev if you're a developer etc.

 

They auto-translated Original Poster as Původní plakát where "plakát" does mean "poster" but only the kind that you hang on a wall.

Another win for auto translation.

 
 
25
submitted 10 months ago* (last edited 10 months ago) by rikudou@lemmings.world to c/rareinsults@lemmy.world
 
 

The time flies really fast! Exactly 2 years ago I was the one and only user of this instance and now there are thousands of us! So happy birthday to Lemmings.world and hope you all enjoy our small corner of the internet!

 

cross-posted from: https://chrastecky.dev/post/16

Starting with PHP 8.5, you'll be able to do the following:

 public function __construct(
    final public string $someProperty,
) {}

This wasn't possible before, as promoted properties couldn't be declared final.

Perhaps the more interesting part is that you can now omit the visibility modifier if you include final. In that case, the property will default to public:

 public function __construct(
    final string $someProperty, // this property will be public
) {}

Personally, I’m not a fan of this behavior — I prefer explicit over implicit. Fortunately, it can be enforced by third-party tools like code style fixers. Still, I would have preferred if the core required the visibility to be specified.

What do you think? Do you like this change, or would you have preferred a stricter approach?

 

cross-posted from: https://chrastecky.dev/post/16

Starting with PHP 8.5, you'll be able to do the following:

 public function __construct(
    final public string $someProperty,
) {}

This wasn't possible before, as promoted properties couldn't be declared final.

Perhaps the more interesting part is that you can now omit the visibility modifier if you include final. In that case, the property will default to public:

 public function __construct(
    final string $someProperty, // this property will be public
) {}

Personally, I’m not a fan of this behavior — I prefer explicit over implicit. Fortunately, it can be enforced by third-party tools like code style fixers. Still, I would have preferred if the core required the visibility to be specified.

What do you think? Do you like this change, or would you have preferred a stricter approach?

 

cross-posted from: https://chrastecky.dev/post/13

This change is quite straightforward, so this won’t be a long article. PHP 8.5 adds support for annotating non-class, compile-time constants with attributes. Compile-time constants are those defined using the const keyword, not the define() function.

Attributes can now include Attribute::TARGET_CONSTANT among their valid targets. Additionally, as the name suggests, Attribute::TARGET_ALL now includes constants as well. The ReflectionConstant class has been updated with a new method, getAttributes(), to support retrieving these annotations.

One particularly useful aspect of this change is that the built-in #[Deprecated] attribute can now be applied to compile-time constants.

As promised, this was a short post, since the change is relatively simple. See you next time—hopefully with a more exciting new feature in PHP 8.5!

 

cross-posted from: https://chrastecky.dev/post/13

This change is quite straightforward, so this won’t be a long article. PHP 8.5 adds support for annotating non-class, compile-time constants with attributes. Compile-time constants are those defined using the const keyword, not the define() function.

Attributes can now include Attribute::TARGET_CONSTANT among their valid targets. Additionally, as the name suggests, Attribute::TARGET_ALL now includes constants as well. The ReflectionConstant class has been updated with a new method, getAttributes(), to support retrieving these annotations.

One particularly useful aspect of this change is that the built-in #[Deprecated] attribute can now be applied to compile-time constants.

As promised, this was a short post, since the change is relatively simple. See you next time—hopefully with a more exciting new feature in PHP 8.5!

 

cross-posted from: https://chrastecky.dev/post/15

PHP has long had a levenshtein() function, but it comes with a significant limitation: it doesn’t support UTF-8.

If you’re not familiar with the Levenshtein distance, it’s a way to measure how different two strings are — by counting the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into another.

For example, the following code returns 2 instead of the correct result, 1:

var_dump(levenshtein('göthe', 'gothe'));

There are workarounds — such as using a pure PHP implementation or converting strings to a custom single-byte encoding — but they come with downsides, like slower performance or non-standard behavior.

With the new grapheme_levenshtein() function in PHP 8.5, the code above now correctly returns 1.

Grapheme-Based Comparison

What makes this new function especially powerful is that it operates on graphemes, not bytes or code points. For instance, the character é (accented 'e') can be represented in two ways: as a single code point (U+00E9) or as a combination of the letter e (U+0065) and a combining accent (U+0301). In PHP, you can write these as:

$string1 = "\u{00e9}";
$string2 = "\u{0065}\u{0301}";

Even though these strings are technically different at the byte level, they represent the same grapheme. The new grapheme_levenshtein() function correctly recognizes this and returns 0 — meaning no difference.

This is particularly useful when working with complex scripts such as Japanese, Chinese, or Korean, where grapheme clusters play a bigger role than in Latin or Cyrillic alphabets.

Just for fun: what do you think the original levenshtein() function will return for the example above?

var_dump(levenshtein("\u{0065}\u{0301}", "\u{00e9}"));
 

cross-posted from: https://chrastecky.dev/post/15

PHP has long had a levenshtein() function, but it comes with a significant limitation: it doesn’t support UTF-8.

If you’re not familiar with the Levenshtein distance, it’s a way to measure how different two strings are — by counting the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one string into another.

For example, the following code returns 2 instead of the correct result, 1:

var_dump(levenshtein('göthe', 'gothe'));

There are workarounds — such as using a pure PHP implementation or converting strings to a custom single-byte encoding — but they come with downsides, like slower performance or non-standard behavior.

With the new grapheme_levenshtein() function in PHP 8.5, the code above now correctly returns 1.

Grapheme-Based Comparison

What makes this new function especially powerful is that it operates on graphemes, not bytes or code points. For instance, the character é (accented 'e') can be represented in two ways: as a single code point (U+00E9) or as a combination of the letter e (U+0065) and a combining accent (U+0301). In PHP, you can write these as:

$string1 = "\u{00e9}";
$string2 = "\u{0065}\u{0301}";

Even though these strings are technically different at the byte level, they represent the same grapheme. The new grapheme_levenshtein() function correctly recognizes this and returns 0 — meaning no difference.

This is particularly useful when working with complex scripts such as Japanese, Chinese, or Korean, where grapheme clusters play a bigger role than in Latin or Cyrillic alphabets.

Just for fun: what do you think the original levenshtein() function will return for the example above?

var_dump(levenshtein("\u{0065}\u{0301}", "\u{00e9}"));
 

test

view more: next ›