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.

Samsy , in They Need To Stop Doing This

Hah, yes, I was a few times between these two sides. My role was to understand both and doing something you could call “translating.”

brygphilomena ,

Well–well look. I already told you: I deal with the god damn customers so the engineers don’t have to. I have people skills; I am good at dealing with people. Can’t you understand that? What the hell is wrong with you people?

SnowdenHeroOfOurTime , in D or d come on

This is a feature, not a bug

Potatos_are_not_friends ,

Right? I rather not have a computer automatically autocorrect.

AffineConnection ,

Also, I constantly name files in the same directory the same thing except for case. In my ~/tmp directory I have unrelated foo.c (C source) and foo.C (C++ source).

winky88 ,

Chaotic evil

Zagorath ,
@Zagorath@aussie.zone avatar

Why not .cpp for C++? I don’t use C++, but I thought that was the standard.

AffineConnection , (edited )

.C came first. I don’t usually use it though; I usually use .cc or .cxx, but if I’m making some tiny test source, I often use .C. I’m strongly opposed to the .cpp extension because calling C++ “CPP” leads to confusion with the preexisting (before C++) use of the initialism to refer to the C preprocessor. There’s a reason why CPPFLAGS refers to preprocessor flags and CXXFLAGS refers to C++ flags.

ThatHermanoGuy ,

Just use .C++

AffineConnection ,

But then the filename wouldn’t be /^[[:alnum:]._-]*~*$/.

shotgun_crab ,

Yeah, and I think most shells will correct this case by pressing tab

MJBrune ,

All folders and files should be in lower case.

UFODivebomb ,

I like your style

bier ,

Why did Linux systems go for capitals in the home folder? It’s actually kind of annoying and takes extra key presses.

…A while later “XDG Base Directory Specification”

MJBrune ,

Why does Linux do anything it does? Because a bunch of shortsighted nerds think it’s a good idea. For example, try to install software on another disk.

ILikeBoobies ,

Any help with that?

nyan ,

Symlink your desired location on the target disk to the place the system thinks the software should go. (In my case, /usr/local/games is a symlink to a different drive.)

ILikeBoobies ,

Thanks

MJBrune ,

As someone said you solution is to symlink or setup LVM volume groups for different mount points. Essentially, it’s all or nothing. You can’t just put a single program on a different disk without then taking all those files and manually symlinking them to the right place. It’s honestly one of the biggest Linux oversights.

zlatko ,

XDG specifies the capital names, but to be nitpickingly technically precise, linux systems don’t do this. It mostly is done by the distribution maintainers, and the XDG specs. A base system does not usually have a notion of anything beyond your $HOME.

Try adding a user: sudo adduser basicuser. If you ls -al ~basicuser you will see it’s almost empty, just the .bashrc (or in my fedora, there’s some .mozilla crap in /etc/skel that also gets bootstrapped).

expatriado , in It’s a game for kids!

oh, i solved that assignment in school… by finding the algorithm online

Karfkengrumble ,

You’re hired, welcome to the team!

LetterboxPancake ,

I had enough colleagues unable to type exactly what they asked me into whatever search engine they preferred to accept your statement. If you don’t know how to use a search engine go ask for another job.

“Hey pancake, how do I run all tests via gradle?”

Open your browser, head to Google and type “run all tests in gradle”

“Oh, nice. Thank you for your help!”

And the next day the game starts all over again.

ChlorineAddict ,

Bonus points for leveraging the work of others contributing to their success

Anonymousllama ,

As it should be, there’s way too much reengineering of the wheel. Let the big brains of the past do the heavy lifting

DragonTypeWyvern ,

screams in that’s not the point

fsxylo ,

Pfft, writing a program that collects user input and displays it is just trite. I’m going to skip straight to building an MMO.

frickineh ,

Science-based, 100% dragon MMO or gtfo.

CurlyChopz ,

I need 100k in my kick starter by tomorrow, sharp

Rodeo ,

You’re right. The learning is the point. So rather than flail in the dark, why not learn the optimal solution?

onlinepersona , in D or d come on
brophy , in It’s a game for kids!

Kids get infinite registers and no restrictions on stack ordering. Programmers are constrained to solving it with one register and restrictions on stack put operations.

./insert we-are-not-the-same-meme

lfromanini , in D or d come on
@lfromanini@feddit.nl avatar

Zoxide and cd down. ;)

WindowsEnjoyer , in D or d come on

OMZ and TAB gang raise up!

PapstJL4U , in It’s a game for kids!
@PapstJL4U@lemmy.world avatar

Before studying CS, I recognized it as ‘the bioware puzzle’. They were probably copying their own scribbles fron back then.

Haskell was the hardest, but it looked the most beautiful.

lugal ,

Haskell was the hardest, but it looked the most beautiful.

That pretty much sums that language up

DarkenLM ,

Strange. I find the language hideous, most likely because it resembles math, or maybe because I'm already used to the C-like syntax.

lugal ,

Haskell is beautiful because it resembles math

xigoi ,
@xigoi@lemmy.sdf.org avatar

It’s also beautiful because it doesn’t have C-like syntax.

mindbleach ,

Functional programming flips your brain around backwards, but shader programming will turn it inside-out.

manpacket ,

For more brain flipping try looking into hardware description languages (Verilog) or proof assistants (Coq).

TheBananaKing ,

In order to write a haskell program, you must first write the corresponding haskell program.

lugal ,

And in order to do that, you have to imagine sisyphus happy

Knusper ,

<span style="font-weight:bold;color:#795da3;">hanoi </span><span style="font-weight:bold;color:#a71d5d;">:: Integer -> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-></span><span style="color:#323232;"> [(a, a)]
</span><span style="color:#323232;">hanoi 0 _ _ _ </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">[]
</span><span style="color:#323232;">hanoi n a b c </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) a c b </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> [(a, b)] </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) c b a
</span>

From here: www.rosettacode.org/wiki/Towers_of_Hanoi#Haskell

DumbAceDragon , (edited )
@DumbAceDragon@sh.itjust.works avatar

https://media.tenor.com/1bIptSWki_kAAAAd/unintelligible.gif

Edit: I understand it now. That first line is just a really weird way to define a function.

Knusper ,

Welp, imma try myself at an explanation. Mostly cause I haven’t written Haskell in a while either.

So, that first line:


<span style="font-weight:bold;color:#795da3;">hanoi </span><span style="font-weight:bold;color:#a71d5d;">:: Integer -> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-> </span><span style="color:#323232;">a </span><span style="font-weight:bold;color:#a71d5d;">-></span><span style="color:#323232;"> [(a, a)]
</span>

…actually only declares the function’s type.

In this case, it’s a function that takes an Integer and three values of a generic type a and then returns a list of tuples of those same as.
So, those as are just any types representing the towers. Could be strings, integers, custom data types, whatever. The returned tuples represent movements between towers.

Following that are actually two definitions of the function.

The first definition:


<span style="color:#323232;">hanoi </span><span style="color:#0086b3;">0</span><span style="color:#323232;"> _ _ _ </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">[]
</span>

…is the recursion base case. Function definitions are applied, whenever they match, being evaluated top-to-bottom.

This line specifies that it only matches, if that first Integer is 0. It does not care what the remaining parameters are, so matches them with a wildcard _.
Well, and to the right side of the equals sign, you’ve got the return value for the base case, an empty list.

Then comes the more interesting line, the recursion step:


<span style="color:#323232;">hanoi n a b c </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) a c b </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> [(a, b)] </span><span style="font-weight:bold;color:#a71d5d;">++</span><span style="color:#323232;"> hanoi (n</span><span style="font-weight:bold;color:#a71d5d;">-</span><span style="color:#0086b3;">1</span><span style="color:#323232;">) c b a
</span>

This line matches for any remaining case. Those small letter names are again wildcards, but the matched value is placed into a variable with the provided name.

And then, well, it recursively calls itself, and those ++ are list concations. This line’s only real complexity is the usual Tower Of Hanoi algorithm.

neonblade , in It’s a game for kids!

Example for stack

ram , in D or d come on

There are two Linux paradigms that I consider stupid. One is the use of centralized software repositories managed by the distro instead of individual developer maintained installers. The other one is file system case sensibility. They already admitted defeat on the first one with the rise of containerised applications. I wonder how much longer they’ll keep the charade on the second one.

charlotte ,

Sorry, but you’re plain wrong on your first issue. Getting all your packages from one source is one of the biggest upsides of Linux.

onlinepersona ,

Pretty hilarious for mac users, of all people, to complain about centralisation. Like, don’t you live in a walled garden?

EddoWagt ,

Indeed, but I’m sure we can agree that it’s pretty stupid for every distro to maintain its own repo. That’s a lot of duplicate work, which could be spend on more useful things. Luckily flatpak is well on its way to change that

charlotte ,

Hm… But different distros have different philosophies (not just) about updates. That’s part of why people choose a specific distro.

Theres still plenty speaking against flatpak (larger sizes, problems with GTK/qt themes, and it’s only meant for GUI applications - you still need a separate system for the kernel and lower-level/cli tools. And frankly, that makes flatpak unusable to me, because the purpose of a centralized package management system is not having duplicate systems).

So in short: y’all are gonna pry pacman from my cold, dead hand.

tslnox ,

The same goes for me, but with Portage, brother.

EddoWagt ,

I’m not against distros as a whole, some extra work will be inevitable because people have different preferences, but it feels like a waste having a Firefox package for arch, ubuntu, fedora and Debian while essentially all being identical. Indeed flatpak isn’t perfect yet, but it works great for me and it’s steadily improving

MJBrune ,

I have a third one for you. Not being able to pick where things install. Everything installs to the os disk. Terrible idea.

CannotSleep420 , in It’s a game for kids!

I took a test once where one of the questions was to solve the tower of hanoi with 2 pegs and 3 disks.

jackie_jormp_jomp ,

That’s just unfair

CannotSleep420 ,

I was lucky enough to figure out that it was a trick question, but I second guessed every answer I put on tests and homework for that professor ever since.

learningduck ,

How is that possible? is it has a different rule?

CannotSleep420 ,

No, it was a trick question. The test taker was supposed to pick up on that.

odium , in It’s a game for kids!

It’s even called tower of Hanoi because of the Vietnam war flashbacks.

steltek , in D or d come on

Here’s how to fix this[+]

Create $HOME/.config/user-dirs.dirs with

XDG_DOWNLOAD_DIR=“$HOME/downloads”

You may need to logout/in for things to reread this file.

The full list of keys is:

  • XDG_DESKTOP_DIR
  • XDG_DOWNLOAD_DIR
  • XDG_TEMPLATES_DIR
  • XDG_PUBLICSHARE_DIR
  • XDG_DOCUMENTS_DIR
  • XDG_MUSIC_DIR
  • XDG_PICTURES_DIR
  • XDG_VIDEOS_DIR

+: Since this is Linux, this is a fix for many but not all cases.

lastweakness ,

XDG User dirs are cool, i agree. But that’s not really the problem here

starman , (edited ) in D or d come on
@starman@programming.dev avatar

So you type cd D tab and it brings you to Documents

Asswaterpirate , in D or d come on

cd snuts

zlatko ,

did you mean smuts?

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