There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Player2 , in They used coding and algorithms

Coding and algorithms. That’s how you know it’s good

sheepishly , in poorPenguin
@sheepishly@kbin.social avatar

Dazed and confused, but trying to continue

He's just like me

guywithoutaname , in There once was a programmer

I strongly advise not to do that. As others pointed out, it really is just predicting the next word. It is worth learning about how to problem solve and to recognize that the only way to become a better program is with practice. It’s better to get programming advice from real people online and read the documentations for the functions and languages you are trying to use.

JeeBaiChow ,

If the internet has succeeded in anything, it’s that the illusion of competence is worth more than the thing itself. Until someone calls you out, that is.

ScrotusMaximus ,

Sage wisdom.

rimjob_rainer , in Spooktober meme time!

java le bad am I rite? updoots to the left

s_s ,

Is this a boilerplate comment?

lemmyman ,

Boilerplate comment for boilerplate meme

s_s ,

Sounds like an inheritance problem.

topinambour_rex ,
@topinambour_rex@lemmy.world avatar

It supports one of the best creative coding language, processing.

words_number , in Microsoft Edge could use a win

Edge is pretty good…

…for downloading Firefox.

I wouldn’t even use a proprietary browser if they’d pay me for it. Let alone a chromium based one.

mp3 ,
@mp3@lemmy.ca avatar

You don’t even need a browser

winget install Mozilla.Firefox

CeeBee ,

That’s a weird way to write apt install firefox

provisional ,

Who needs to sudo apt install firefox when it already comes preinstalled on most distros?

Gingernate ,

where my zypper fam at?

Barbarian ,
@Barbarian@sh.itjust.works avatar

That’s an usual way to write snap install firefox

words_number ,

No!

apt: ok

pacman: ok

flatpak: ok

appimage: ok

built stuff from source: ok

snap: over my dead body

Morphit ,
@Morphit@feddit.uk avatar
words_number ,

True, I missed that winget is now preinstalled with newer windows versions. I don’t use windows a lot though, especially not for browsing the web.

aubertlone , in Microsoft Edge could use a win

Y’all I dislike forced browser adoption as much as the next guy.

And I’ve been using Firefox for years and years and years now.

But, I’m forced to use edge for work. And, as a browser purely, none of the anti-trust baggage attached…

It’s really not too bad. A lot of things work just fine. And sometimes, if I’m having weird performance on a website on a personal device, loading the same URL in edge has resulted in improved/expected functionality of the website

mnoom ,

with the amount of updates I think Edge is better than chrome now, but I still use firefox

soviettaters ,

I continue to use Firefox because I started using it a while ago and would rather not switch. I have to use Edge for school and it’s legitimately equal to Firefox in many ways. With Bing AI added, Edge blows Firefox out of the water.

PoolloverNathan ,

The only reason Bing AI only works on Edge is because Bing AI specifically checks for edge. There was an extension that made it work on Firefox by simply lying about the browser, but Microsoft DMCA’d the developer.

grumpyoldgit ,

Yes, when I have used Edge it’s been absolutely fine. Probably better than Chrome. I’d likely be quite happy to use it most of the time if it wasn’t for the fact that Microsoft are so intent on forcing me to do so.

I mostly use Vivaldi now which I think is by far the best of the Chromium-based browsers.

explodicle ,

IE was like that for a while too. Never again.

ILikeBoobies ,

Yeah the problem with memes like this is (according to market share) that there are people that switch from Edge to Chrome and think they are actually using a better product

PixxlMan ,

Edge isn’t terrible at all. That’s why it’s such a risk to browser diversity and competition

jack ,

Change your job

Gestrid , in ಠ_ಠ
nexv , in Unpaid community work is best!

GitLab don’t have the monetary incentive to implement federation. Most of their revenue is coming from big companies which are mostly using private GitLab instance and won’t want their projects federated.

That being said, hope this changes can get merge as somebody already done the dirty work for them. The beauty of open source.

onlinepersona OP ,

How can more instances not lead to more money? Look at the explosion of mastodon and other federated software. There’s a lot of good will in the community and being a viable competitor to Github is definitely not worth nothing. If Gitlab could offload the majority of users from their main instance, I bet it would actually save them money. And more users, probably also means more contributors since they’ll have experience hosting the instance and fixing issues they run into.

IMO, it’s short-term thinking to say “federation is of no value to us”.

angelsomething , in How the IT guys see the users

If I had a penny for every time, I was told I’m a genius for helping someone with something easy, I’d probably about a fiver.

painfulasterisk ,

Nah, you didn’t give us admin privileges. You just forced them to call you that way.

Bipta , in My poor RAM...

This meme is really only true for things like Slack where the app is just the webpage in an app, and even then it's not quite true because Electron is a lot heavier than a webpage because it has to now run the webpage and the app - which I think is terrible.

But then also, Electron enables actual apps to be developed using web standards - which I think is great.

TLDR: Use Electron to make apps, not glorified webpages.

habanhero ,

??

Slack IS an app.

Chadus_Maximus ,

??

Slack IS a webpage.

habanhero ,

Calling Slack a webpage is like calling an office building a room.

Slack is just as much a complex app as anything else even if it’s built on web tech and standards.

firelizzard ,
@firelizzard@programming.dev avatar

The point is that Slack does not take advantage of Electron at all. It’s no better than running it in a browser.

habanhero ,

For Slack it does. Building an app via Electron means it’s cross-platform by default, so Slack doesn’t need to invest in separate platform teams to solve the same problem (Windows, macOS, Linux).

Electron also has better support for things like native notifications, video and voice calls, offline capabilities, and to other native APIs etc that are either unsupported or spottily supported via the browser.

pkill ,

Flutter?

habanhero ,

What about Flutter?

pkill ,

It’s a much more lightweight option for building cross platfrom apps than Electron. Heck, even Tauri is better than Electron even though it also uses web technologies for UI.

habanhero ,

Flutter came to market much later. It wasn’t even a thing when Slack started building using Electron. I’m sure the same applies to Tauri as well.

railsdev ,

It has all this support for native platforms yet it’s always a clunky memory hog that makes zero effort to respect the design language of the OS it’s running on.

I’m on macOS, I want the app to be a native macOS app. If I wanted it to look like a webpage, or Windows, or Linux GTK then I’d switch to one of those and expect it to match those paradigms.

habanhero ,

It has all this support for native platforms yet it’s always a clunky memory hog

Maybe so but it has improved a lot over time. The app devs share some responsibility too so it’s not all on Electron.

zero effort to respect the design language of the OS it’s running on.

That’s the Dev’s design choice, not a limitation of Electron.

I’m on macOS, I want the app to be a native macOS app. If I wanted it to look like a webpage, or Windows, or Linux GTK then I’d switch to one of those and expect it to match those paradigms.

I don’t disagree but at the end of the day it doesn’t matter to enough people for it to become an issue. People are used to Slack and the way it works.

Moreover the cost of building the same app 2x or 3x simply doesn’t make business sense.

railsdev ,

I’m a web developer but is there no concept of classes, libraries, etc in other programming languages?

What happened to writing the “core” of an app that doesn’t rely on UI then simply writing the front ends for each platform you want to support?

You keep saying Electron is used for better compatibility and listing out Linux, Windows, macOS but here’s the thing — most companies are only targeting those. That’s just three (if you don’t write for a million desktops on Linux).

Is it really so hard to support just three environments with only the UI being tailored for the OS it’s running on?

Honestly, it just feels like poor tooling and a poor excuse.

habanhero ,

What happened to writing the “core” of an app that doesn’t rely on UI then simply writing the front ends for each platform you want to support?

What do you mean? I can’t speak for Slack but I’m sure some degree of business logic / client side logic separation exists.

By the way, what you just described is the essence of cross-platform development, rather than an argument for building apps natively.

simply writing the front ends for each platform you want to support?

But why would you rewrite the “front-end” for each platform if you have one you could just port over? Who is going to pay for those 2x developers and what would be the ROI on this effort?

That’s just three (if you don’t write for a million desktops on Linux).

Is it really so hard to support just three environments with only the UI being tailored for the OS it’s running on?

In Slack’s case I’d wager the answer to be a resounding YES. I don’t think you fully grasp the full scope Slack’s capabilities, and the amount of work involved to build native clients for not just one or two, but three different platforms - it’s definitely not just the “UI”.

Honestly, it just feels like poor tooling and a poor excuse.

Quite the opposite - frameworks like Electron let’s devs with your skillset build with the stack you already know, and abstracts away quite a bit of the cross-platform complexities, which strangely enough is what you are suggesting but also what you are arguing against

mcmodknower , in Every Single Freaking Time

It didn’t load completely at first, so i saw something like this and i think it is even better that way:

https://programming.dev/pictrs/image/66d157d8-11fa-4d30-bf60-199f31c6853e.png

DR_Hero ,

Now I’m upset this wasn’t the original haha

wols ,

I think it works better with the context of the original already present.

00dani , in Some people just wake up and choose violence
@00dani@lemmy.blahaj.zone avatar

huh. what was the rationale for removing it in the first place? seems like a waste to throw away a whole codebase worth of perfectly good type annotations

NatoBoram ,

No rationale provided.

QuazarOmega ,

JSDoc enjoyers:
tumbleweeds rolling

Phen ,

They wanted to generate controversy to help market a new set of products they are announcing.

foobaz ,

shitposting

turbodrooler , in Which side are you? Javascript or Typescript

Me: 2024 is finally going to be the year of WASM, boys!

zagaberoo ,

I just wish WASM could replace JS rather than merely augment it for non-DOM work.

Knusper ,

You can have frameworks which fully generate the JS DOM code for you, allowing you to write complete single-page applications without writing a single line of JS.

float ,

I’m using the leptos framework (Rust) and really like it so far. Not a single line of JS, not even npm as a dependency in that project.

Knusper ,

Yep, that’s the framework, I’m using, too. But most frameworks in the Rust ecosystem can do DOM interop, as the heavy lifting for that is provided by the wasm-bindgen library.

iegod ,

And then there’s me, missing flash :(

Flash and AS3 was so much fun to work in. I completely understand why the industry moved away from it but even today we have yet to fully catch up to all the media animation and programmatic features it provided all in one. RIP.

turbodrooler ,

I still have a hobby website with an AS flash animation on it that I don’t have the heart to get rid of. It was so cool.

MajorHavoc ,

That’s awesome.

But I’m picturing you keeping a retro computer to load it on and enjoy it.

ICastFist ,
@ICastFist@programming.dev avatar

Have you tried porting it to Haxe? It’s what I found whose selling point was “programming for those that know AS3”

turbodrooler ,

Thanks, I will look into that

qaz , (edited )

You could use something like Ruffle. Newgrounds also uses it to allow people to play flash games.

turbodrooler ,

Thanks, will check it out

ShortFuse ,

Starfield has a bunch of AS3 and Flash files. I’ve been hacking it all week.

And, uh, I use vanilla JavaScript with Typescript checking via JSDocs.

severien , (edited )

Unpopular opinion: I hope it’s going to be a flop (apart from the few use cases where it does make sense). The limitation of having just JavaScript ensures level of interoperability which is IMHO one of the big advantages of web as an application platform. If WASM becomes successful, it will fragment the web.

turbodrooler ,

I definitely feel you. Not sure WASM is the answer, but it’s still neat.

darcy , in Which side are you? Javascript or Typescript
@darcy@sh.itjust.works avatar

typescript is a bandaid on a severed leg

MajorHavoc ,

MyPy for Python hides in the bushes.imgflip.com/7yinbx.jpg

darcy ,
@darcy@sh.itjust.works avatar

image not found :(

Kuresov ,

Mypy is just okay. Haven’t used TS to know the dark corners there, but any type system that’s bolted on to the language is going to have dark corners in the best case.

It’s better than no type system, however. I remember when typed languages were “bad” because it “slowed you down” and “wasn’t necessary if you know what you’re doing”… how naive I was when I repeated those words so many years ago :)

JakenVeina ,

More like a tourniquet and a prosthetic. It doesn’t solve the underlying problem, but it’s the best solution we’ve come up with.

fidodo ,

I view it more like a powered exoskeleton around a blob fish. IMO static typing is way more valuable than strong typing and I’d take static typing only over strong typing any day if I can only choose one.

LanternEverywhere , in I'll just sort it myself

As a non-programmer, why does it do this? Sorting by leftmost digit seems super dumb.

jormaig ,

Because when it’s sorting some of them as ints and some of them as strings. JavaScript has implicit conversion to string.

kevincox ,
@kevincox@lemmy.ml avatar

Wrong. JavaScript sort’s default comparison function always converts to strings.

jormaig ,

Only if one of them is a string right? If you have only numbers then it works fine right? Right? (Please say that I’m right 😭)

kevincox ,
@kevincox@lemmy.ml avatar

No. It always compares by converting to string. I actually think this is more consistent then having different behaviour if you have a string somewhere in your list.

Basically the default comparator is a.sort((a, b) => ${a}<${b} ? -1 : 1).

nero ,
@nero@lemmy.world avatar

It sorts them based on their unicode character, not the actual numbers. 1 is U+0031, 2 is U+0032, etc.

KiofKi ,
@KiofKi@feddit.de avatar

“By default, the sort() function sorts values as strings.

This works well for strings (“Apple” comes before “Banana”).

However, if numbers are sorted as strings, “25” is bigger than “100”, because “2” is bigger than “1”.

Because of this, the sort() method will produce incorrect result when sorting numbers.”

www.w3schools.com/js/js_array_sort.asp

floofloof ,

It also produces incorrect results in many languages other than English. You can pass it a compare function that uses localeCompare or Intl.Collator to get a correct alphabetical sort.

ImpossibleRubiksCube ,

JavaScript is what’s called an “untyped” language, so here, it assumes that the numbers are words, and tries to sort them alphabetically. Specifically, it tries to sort them alphabetically as a dictionary would in a left-to-right language like English. In this case, just as “apple” would come before “asterisk”, 100000 would come before 21.

(Some would argue that it’s more of a “weakly typed” language, I know, but I’m trying not to be pedantic here.)

Sorting them as actual numbers would require some extra explicit instructions and guides. Most typed languages, like C, aren’t like this.

affiliate ,

is there a good reason for javascript to work like that? python also isn’t typed like C and it sorts integer lists in the “normal” way, so it seems avoidable. (i don’t really know what im talking about here. i’ve never used javascript and i’m not familiar with how typing works under the hood.)

Quasari ,

Mainly because JavaScript was designed to work along side HTTP in a browser. Most of its input will be text, so defaulting common behavior to strings makes some sense.

affiliate ,

thank you for the explanation, that does clarify things

severien , (edited )

That’s misleading at best and most likely just false, and it’s worrying it’s so upvoted.

There’s no historical record explaining why this was designed this way, but we can infer some things. HTTP is very unlikely a factor, XHR / AJAX has been added years after the .sort() function. Additionally, it doesn’t make sense in the context that other comparisons are not string-wise (sort()/quicksort is basically a series of comparisons).

The trouble with JS arrays is that they can contain any values - e.g. [false, undefined, 1567, 10, “Hello world”, { x: 1 }]. How do you sort those? There must be one function to compare every combination of value, but how do you compare booleans and objects?

There’s no such function which would provide reasonable results. In that context, doing .toString() and then string-wise comparison/sorting doesn’t seem that crazy - every object has .toString(), it will compute something, and often it will work well enough.

There could be some additional smartness - if the array contains numbers only, it could choose to use a number-wise comparison function. But that would require a) extra implementation complexity (JS was famously designed in short time) and b) reduced performance - since JS runtime doesn’t know what type of values are present in the array, it would have to scan the whole array before starting the sort. But I guess the a) was the decisive factor in the beginning and backwards compatibility prevented improving the function later.

Quasari , (edited )

You are probably correct. I don’t know if it’s true, it’s probably more likely it was a way for it not to fail.

I said HTTP mainly because HTML is plaintext because of it. 1.0s main purpose was to manipulate the page. Of course Array objects weren’t added til 1.1, when netscape navigator 3.0 released, but it was still mostly 1.0 code. I felt like having everything be coercable to string made it easy for you to just assign it to the document. If you assigned the wrong thing it wouldn’t crash.

I originally thought there was a precursor to microsofts XMLHTTP in an earlier version due to the 1997 ECMAScript documentation specifically talking about using it both client and serverside to distribute computations, but it was far more static. So, I’m probably just wrong.

kevincox ,
@kevincox@lemmy.ml avatar

The hard part is sorting values of different types.

Python 2 had a order of built it types. Something like None < bool < numbers < strings. This means that you could sort anything like JavaScript and behaves fairly reasonably.

Python 3 takes the “safer” approach and comparisons of different types throw an exception. (You can override the comparison behavior for your own types and do something different).

JavaScript has conventionally been a very loosely typed language. So it almost certainly wouldn’t have chosen the exception throwing option. It does something similar to Python 2. But instead of just directly comparing the values of different types it converts them to strings first, then compares everything as a string. This is probably the most reasonable option. Otherwise you would have problems because 10 &lt; “2” and “2” &lt; 3 but 3 &lt; 10. How can that work? You have no total ordering! So basically because the comparison operators convert to strings if either argument is a string the default sort comparator really doesn’t have a choice but to do convert to string. The other option would be to define a total order just for the sort function but that seems more confusing.

floofloof , (edited )

It’s also an incorrect alphabetical sort in many languages that use accented characters. For a correct sort you need to pass it something like the localeCompare function or Intl.Collator.

fidodo ,

You can put any type of value in an array in JavaScript. You can have numbers, strings, booleans, arrays, and objects. So what should the default sort function sort by? Sorting by numbers makes sense, but what if it wanted to sort strings instead?

When you don’t know what value is in an array ahead of time you can’t assume how to sort it. When you’re controlling the program you can provide a sort function for the type of values you know will be in it, but when you’re writing the standard default sort function, there’s only one type that you can convert all the other types to safely and simply in the most predictable way, which is strings.

reverendsteveii ,

Think of digits like you would letters. You’re essentially sorting numbers alphabetically. It’s not the right way to do it, of course, but it’s the natural way to do it using a system like computers use that doesn’t necessarily differentiate between digits and letters unless you tell it to specifically.

CheezyWeezle ,

I think the main shortcoming here is that there isnt a way to specify the type to sort as, instead you have to write the function to compare them as numbers yourself. If it’s such a simple implementation, why isn’t it officially implemented? Why isn’t there a sortAs() that takes two args, the input list, and a Type value? Check every element matches the type and then sort, otherwise return a Type Error.

reverendsteveii , (edited )

I mean, there’s a sort() method that takes a comparator(a,b) such that if a comes first it returns 1, if b comes first it returns -1 and if they’re equivalent wrt sortinf it returns 0. If you absolutely need type safe number sorting you can use that to get it.

CheezyWeezle ,

Right, but you have to make that comparator yourself, it’s not a built-in part of the language. The only built-in comparator converts values to strings and compares them in code units orders.

Also, that technically isnt type-safe, is it? If you threw a string or a NaN at that it would fail. As far as I knew, type safe means that a function can handle type errors itself, rather than throwing an exception. So in this case the function would automatically convert types if it was type-safe to prevent an unhandled exception.

reverendsteveii ,

Not every use case can be the built-in default. I wouldn’t have made JS weakly typed if I were designing it, but once the decision was made to use weak typing it made sense to either have no default sort method or to have a default sort method that assumes a type.

What I’ve outlined for you is the interface for a comparator, not the implementation. You can type check and convert and do anything else you want under the hood of the comparator you write.

CheezyWeezle ,

It doesn’t have to be the default to be built in, tho. It could be an overloaded function, having the “default” be the typical convert-to-string sorting, and an overloaded function that allows to specify a type.

It’s just such a common thing, wanting to sort a list by different types, that I’m surprised there hasn’t been an official implementation added like this. I get that it a simple “fix” to make, but I just think that if it’s that simple yet kind of obscure (enough that people are still constantly asking about it) there should be an official implementation, rather than something you have build yourself.

reverendsteveii ,

Thats just JS for you. If you’re being generous, it’s a “quirky” language. If you’re being ungenerous, it’s a steaming pile of arbitrary decisions, gotchas, unexpected behaviors and problems that no one bothered to solve because there’s a workaround.

CheezyWeezle ,

Yeah, JS always seemed like the red-headed stepchild of modern languages. I’d be curious to know if other ECMAScript languages like JScript are as, eh, “quirky”, suggesting that the ECMA spec is the source of the quirkiness, or if JavaScript itself is the one making silly decisions. Technically, I mostly work with Google’s AppScript when I use ECMAScript stuff, but I’m fairly certain AppsScript is based off of JavaScript instead of directly based on the ECMA spec, so I don’t think it’s separate enough for me to draw a conclusion there.

Blackmist ,

Because it turns everything into text first. Just in case you try to sort [1,“apple”,45.99,false,[true,3]] rather than an array of similar things like a normal person.

jdeath ,

it’s lexicographic order

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines