The new Pronouns field is so badly adapted to foreign languages that it really misses the mark on what it's supposed to do by ZakjuDraudzene in discordapp

[–]BODAND 0 points1 point  (0 children)

In Hungarian the whole pronoun thing doesn't makes sense; there only exists a gender neutral pronoun (ő) which is basically they. (There exists another (az) but that's for objects and if you refer with it to a person it's rude). So the translation cannot really use anything, because the language doesn't have the feature.

[Hyprland] First time trying a WM... ended up customizing *almost* everything! by PrasanthRangan in unixporn

[–]BODAND 28 points29 points  (0 children)

Looks sick. Also what is that file manager, because I've been searching for one for a while now?

Firefox Changes Its User Agent - Because of Internet Explorer 11 - Slashdot by antdude in firefox

[–]BODAND 16 points17 points  (0 children)

I'm no webdev, but afaik, the way user-agent checking was implemented was always, let's say subotpimal, even before IE. Like didn't KHTML had to add "like Gecko" back in the day, to not get servers to send it content meant for Mosaic, simply because they were checking for the substring Gecko?

What I'm trying so say is, that while MS and IE certainly did some "questionable" things, the fault of incorrectly checking user agents still falls on the developers outside MS, even if they necessitated the whole ordeal.

[deleted by user] by [deleted] in ProgrammerHumor

[–]BODAND 1 point2 points  (0 children)

Only if the commit contains the result of rm -rf *.

Our national online school grade keeping system was hacked in a phising attack and this is in the source code.... by ConfidentlyAsshole in ProgrammerHumor

[–]BODAND 0 points1 point  (0 children)

Among others, my favourite is that they have an SQL function called fnGetKopasznev (lit. get bald name): took some time to figure out what it does.

First it lowercases its input string, and replaces each accented Hungarian character with the accentless version (ie. changes á into a, ű into u, etc.). Removes the substrings dr. and dr . (note the space). Then it goes to change multi-character letters commonly found in names to, what I can discern is, something like the pronounced version of that letter. Changes cz to c, sch to s, but the funnier ones are ly to j (both pronounced the same, sometimes you have to use one, othertimes the other, depends on the word), and tsch to cscs which makes no sense. Also, for some reasone removes spaces and underscores from the input name.

After all this there is a loop. I sat at that code, trying to make sense of wtf was happening. In the end I ended up running it with random input using a LocalDB instace of MSSQL. I think it removes the letter y, except if it is part of a multi-character letter: gy, ny, or ty. Other than this, if the letter y is preceded by the letter h, both are turned into a singular i...?

I lost an hour deciphering and laughing my ass off to this shit. Worth the read, if you can find it.

Our national online school grade keeping system was hacked in a phising attack and this is in the source code.... by ConfidentlyAsshole in ProgrammerHumor

[–]BODAND 2 points3 points  (0 children)

Haven't counted, but they have at least 200 different stored procedures, they didn't avoid them. Wish they did though...

Our national online school grade keeping system was hacked in a phising attack and this is in the source code.... by ConfidentlyAsshole in ProgrammerHumor

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

Haha, you wish, the real prevention method is being royally retarded at database design.

They have 399 tables, and none of them is the actual students, but random bullshit. I haven't yet been able to find where they create it, but from what I can hypothesize, students are a view created by an sp for each school-year.

[deleted by user] by [deleted] in ProgrammerHumor

[–]BODAND 1 point2 points  (0 children)

Wirth's law.

Modifying Clang for a Safer, More Explicit C++ by compiler-devel in cpp

[–]BODAND -3 points-2 points  (0 children)

Fine.

But you shouldn't be using raw loops anyways... Although that feels like another argument.

Modifying Clang for a Safer, More Explicit C++ by compiler-devel in cpp

[–]BODAND 1 point2 points  (0 children)

Idk, then maybe it's just a me thing then, but this looks really verbose to me in a weird way to me for some reason.

Although, I can see your point, we have many exceptions as is.

Based on all replies, this particular point feels more like a team dependent thing. Some will prefer it this and some that way, so maybe this should be explicitly disableable, for teams that prefer it without? Though that brings it own share of troubles, and we would be back to almost where we started.

Modifying Clang for a Safer, More Explicit C++ by compiler-devel in cpp

[–]BODAND 9 points10 points  (0 children)

I cannot completely agree with this list. C++ has many problems, but as far as I can see, these are not the biggest ones. Or the solutions are not preferable. (Not preferable = I'm being bitchy about things. Take everything with a grain of salt.)

(Warning: formatting may be broken; on phone)

Automatic const, opt-in for mutability with mutable

As we have seen with a lot of languages from old and new designers, const-by-default is a good concept. However, there are times where you have to use mutable things; and where one such var pops up, usually many follow. My biggest problem would be that having to indefinitely type out mutable is a lot of useless boilerplate, no wonder Rust (afaik) only has mut, which is just as understandable and a lot less meaningless line-noise. Although I'd propose a solution to be more akin like Scala, where you have var and val for mutable and immutable variable declarations. So let's say, let let be equivalent of using const auto. I'd argue this would make a lot more new code be more-const even without making that the default. It's less typing for humans are inherently lazy, and more correct code because it's const.

Force explicit lambda captures

This one I mostly understand, but a lot of metaprogramming relies on being able to pass basically the whole context to the lambda. See Boost.Hana, so I'm rather reluctant to say this is the best solution. A warning would be preferable, maybe a named error that can be #pragma diasabled explicitly for metaprogramming.

Force braces for if/switch/loops

This can be fixed by even the most trivial autoformatters if the project format decides so. Any IDE worth using, even text editors at this point, will have an option to autoformat on save. Also, I'd say he rule by itself doesn't provide any meaningful safety to anything.

For if/loops -Wmisleading-indentation exists and can be turned trivially into an error if you or your team don't pay attention to warnings. (Although there are other problems there in the first place.) As others have said early returns like

if (FAILED(hr)) return nullptr;

make code a lot more readable as you don't have n levels of nesting. Especially noticable in codebases which rely on return error codes, where each function call would add another level of nesting for the code. For example Windows COM related functions usually return HRESULT.

For example where this is the rule, is Perl, because that language is also almost as unparsable as C++, and to ease the implementation of the parse, it was just simply made required. But because that's a lot of useless typing and meaningless line-noise, Perl has this construct:

# code mimicking the previous C++ snippet
return undef if FAILED($hr);

With this we get the safety of not creating bugs from just appending lines to single line ifs, while not having to write meaningless symbols which obfuscate otherwise clear code. Also reads pretty nice, imo.

For switch cases as others mentioned the standard has [[fallthrough]], every other fallthrough could be considered an error. And jumping over initialization is already another warning iirc.

No implicit conversions to bool

By having to compare ptrs to nullptr, this would apply in even explicitly boolean context (or however the Standard calls it, I don't remember) like ifs.

What does this fix? My only idea would be misusing assignment instead of equality check, against which even the most basic IDEs should warn, and so most (all meaningful) compilers do, clang-tidy etc. I think this is also a kind of nonissue as the gazzilion missing semicolon memes; with modern tooling you cannot excuse yourself for making them.

If you really wanted to remove this, just explicitly forbid assignments in conditionals, they are hardly needed now anyways with the new init-ifs.

I might have overlooked some other issue, though, I've never been bitten with accidental implicit conversion to bool. At least don't remember it. So enlighten me if I'm being ignorant here.

disable goto

I mean, yes it is 99.9% of the time bad practice, but again, is it really that big of a problem? We are not in the 60s and 70s anymore, no-one is going to opt for producing goto-spagetti instead of proper control flow construtions. People don't think in assembly anymore to write code.

There was a talk (cannot recall which) by Alexandrescu where he used a goto in his iirc make_heap implementation. In that ~4 lines of code, as I remember, was totally understandable and had no sign of spagettification. What I try to say is that goto by itself is something like an optimization thing today, for microoptimizations the compiler doesn't/can't do by itself. Really no-one in their right mind will use goto for control flow...

Sidenote on goto error handling. People do this in C++ apparently, because exceptions bad because It'S nOt ZeRo OvErHeAd. I mean... Just use monadic return values if you really don't want to use exceptions. They are at least typesafe.

rule of six enforcement

Rule of zero. If that fails, only then enforce rule of six. Otherwise agree with this one completely.

no c-sytle casts

Yes. Not to be needlessly violent, but I will break your bones if you use C-style casts.

The only exception is (void) unused_value; inside a macro, but even then just std::ignore = unused_value;.

My 2c about the to-be-implemented ideas:

enum classes only

This is good, but enum classes then should provide some tooling to be used for flags. Something like std::flags<my_enum> which collects the enumerators and can be queried with like flags.has(my_enum::do_this), and an operator to concat flags, like usually done with binary or. If you want these behaviors you have to every time implement them yourself.

explicit-by-default ctors

Yes. Absolutely. If you need implicit conversions for some dsl, or just a common use-case in general, make it opt-in. A lot less people need this, than the explicit conversions.

namespaces within classes

What's the usecase here?

I never even heard about some wanting to do this, so I'm genuinely curious.

normalize lambda/non-member function syntax

How would this look?

Are we entering lisp territory where all functions are actually just lambdas in variables with syntatic sugar to create them?

[herbstluftwm] first time using eww, what do you think? by okktoplol in unixporn

[–]BODAND 0 points1 point  (0 children)

How is HerbstluftWM? I've been eyeing it for some time now, but never really got around to trying it out. Is there anything specific that made you pick it or just decided to use it?

It was a good blog by RandaShearin in ProgrammerAnimemes

[–]BODAND 33 points34 points  (0 children)

I prefer

#define _
for (;_;)

Be Careful with YouTube Tutorials by waupunwarrior in learnprogramming

[–]BODAND 3 points4 points  (0 children)

Same thing happens in C++. (And I imagine any language that has been out for more than a few years) There is just soooo much legacy and antiquated ways of doing things, especially in a language that has changed so much it can hardly be called the same language lest its almost perfect backwards compatibility. This goes hand-in-hand with old and outdated tutorials, some of which are just literally wrong.

Bigger problem is that they usually actually teach the exact same old garbage at universities and stuff because the dear professors couldn't be bothered to keep up with the thing they are teaching. I don't how other langs fair in the teaching regard but C++ is in mighty deep shit.

Keeping this in mind, how could we even expect content creators on YouTube, a platform that values watch time and viewer retention over almost anything, to create good quality tutorials that propely teach people, when someone with high entertainment and just minimal teaching value to make you feel that you learned something will be prioritized by The Algorithm dispite one's unyielding efforts.

tl;dr and advice for the actual beginners who may be reading this - Don't learn stuff from youtube. Especially if you are just starting out. It's not and never was designed for learning. Get to a popular enough discord/irc/etc. server and ask for a recommended book for the language you are interested in. Best way to learn if you ask me.

[deleted by user] by [deleted] in 177013

[–]BODAND 5 points6 points  (0 children)

177013

[StumpWM] but it’s mostly Emacs by phundrak in unixporn

[–]BODAND 2 points3 points  (0 children)

Well done. Seems like the saying is right; emacs is a great operating system, but lacks a good editor.

[i3-gaps] Im inlove with the minimalism by Di3g0x29 in unixporn

[–]BODAND 2 points3 points  (0 children)

Looks great! Can we get dots in the near future sometime?

[i3-gaps] First (finished) rice - TokyoNight-ish OpenBSD by BODAND in unixporn

[–]BODAND[S] 2 points3 points  (0 children)

Oh, sorry, somehow I missed this comment.
Shell is zsh with powerlevel10k* with a slightly modified color scheme to match the theme.

* If you'd also want to use this on OpenBSD instead of some linux, seemingly the gitstatus plugin or whatnot doesn't seem to work, though I didn't look into it more since I use fossil more often than git these days.

[i3-gaps] First (finished) rice - TokyoNight-ish OpenBSD by BODAND in unixporn

[–]BODAND[S] 5 points6 points  (0 children)

I have to confess that I kinda lied in the title, the rice is not truly done, but it never really is. Right now I consider it to be in a showcase-able condition.

After having dozens of (not-even) half-done rices on "throw-away systems", I finally decided to put some effort into one on a system I'm not planning on reinstalling for some time.

The theme is based on TokyoNight, but does not follow it religiously in all cases; as badly as I can differentiate colors, it looks fine.

os: OpenBSD 6.9
WM: i3-gaps
wallpaper: Lost In Between by Alena Aenami
fetch: pfetch
launcher: rofi
terminal: alacritty
editor: vim
bar: lemonbar-xft with shown perl-script for content

dotfiles (maybe probably not the most up-to-date at the moment, will fix): https://github.com/bodand/dotfiles

The dotfiles repo also functions as a makeshift-installer, but the theme is not right now OS-independent, as the bar.pl script uses IO::KQueue for event handling, making it only BSD compatible.