
Helloooo! I am Moose! They/Them/He/Him I am a embedded software engineer with autism, depression and anxiaty ( Wooo! ). I post about... whatever I want... software things, mental health things... whatever I feel like Feel very wellcome to send me asks about... anything that strikes your fancy :3
266 posts
OK, Who Will Be Up For This Idea?CODEBLR CODING ADVENT CALLENDAR!( "BEST IDEA EVER!" - Everyone)So Basically,
OK, who will be up for this idea? CODEBLR CODING ADVENT CALLENDAR! ( "BEST IDEA EVER!" - Everyone) So basically, Advent of Code is a online competition of solving a daily programming puzzle the best. As they write on their website "please don't use AI to get on the global leaderboard.". So anyone who wants to be an asshole, can just use AI and get on the leaderboard. Which basically means the leaderboards are worthless. BUT! It is still fun to do. It is just more fun together with people SO I HAD AN IDEA! How about we on the codeblr discord makes a channel to facilitate this? Where each of us uploads github repository links and talk about our solutions and how we are thinking about the problem and how our code works? I think that would be SUPER fun (I would not be able to participate every day. But on the days I have time I will definitely join in!!!) (I was inspired by xiacodes post: )

Link to the competition website:
-
instantcoffeedemon reblogged this · 1 year ago
-
brain---soup liked this · 1 year ago
-
trxnmagic liked this · 1 year ago
-
green-mountain-goose liked this · 1 year ago
-
su-andherpileof-thoughts liked this · 1 year ago
-
vexacarnivorous reblogged this · 1 year ago
-
variablecemetery liked this · 1 year ago
-
perfectlyimperfectmuse liked this · 1 year ago
-
xtekker liked this · 1 year ago
-
nourhanlwt liked this · 1 year ago
-
moose-mousse liked this · 1 year ago
-
khoidi liked this · 1 year ago
-
elegance-and-grit liked this · 1 year ago
-
batmanslemontea liked this · 1 year ago
-
sssquidee liked this · 1 year ago
-
cyberfolktale liked this · 1 year ago
-
logicspirit reblogged this · 1 year ago
-
pianistbynight liked this · 1 year ago
-
unit-3301 liked this · 1 year ago
-
xiabablog reblogged this · 1 year ago
-
xiabablog liked this · 1 year ago
-
ladyargento reblogged this · 1 year ago
-
ladyargento liked this · 1 year ago
-
b8horpet liked this · 1 year ago
-
do-electrons-spin reblogged this · 1 year ago
More Posts from Moose-mousse
Calling by reference in C++ Also known as STOP OVERTHINKING EVERYTHING
So I have now seen a specific type of horrible code from several programmers at my internship who really should know better. The code will look something like this:

And when I ask how on earth they managed to overcomplicate "calling a function" I get the answer "I am calling by reference!" Which... no... no you are not. So, there are two ways to feed arguments to a function. Known as calling by value, and calling by reference. When you call by value, the compiler takes a COPY of whatever you send in, and your function works on that copy. (By the way, that is faster than calling by reference when you need to send in small primitive variables, since playing with a 64bit address is harder than moving the 16 bits an int often is ) What is happening in the... abomination of a function call here, is that they use a shared pointer. And shared pointers are a great tool! It gives you all the safety and easy of use of working in a single thread environment with a statically allocated variable (IE, a variable allocated on the stack) when you are working with dynamically allocated memory in a multi-threaded environment. But when you use it on a statically allocated variable in a single threaded environment... then.... it gives you all the safety and easy of use... that you already had... When I asked why on earth they were doing this to that poor poor pointer, I got told that it was because using raw pointers was bad... Ok... first of all, yes, raw pointers are bad. Not really in of themselves, but because c++ have better tools than them for 99% of use cases... But that is not a reason to use a pointer at all! When I told him he was calling this function by value... just in a really weird complicated way, he disagreed. He was using a pointer! Yes... you are putting in a pointer... which gets copied... And together with the work on creating the pointer and the more complicated syntax of using a pointer... it is just bad. You know how you call by reference? You do it... by calling... with a reference... Not a pointer, a REFERENCE. The hint is in the name! This is the refactored code:

THAT is calling by reference. It is quick. It is clean. It is easy. The ONLY change from calling by value is in the signature. Both from the perspective of someone who uses the function and from inside the function, it works JUST like a call by value. Just like using a pointer, it allows you to work directly on a variable from an outher scope instead of copying the variable into the function. And unlike a pointer, a reference guarantees that whatever you are being feed is instantiated. You can send in a null pointer, you cannot send in a null reference (Well...Technically you can, but you have to work really hard to be able to.) Like... often in programming, the easiest way, that requires the least amount of work, is also often the most efficient and the easiest to maintain... just... just do it simply. I beg of you. Code models reality, and as a result can get really really complicated. So let us keep the simple things simple, yeah? ( By the way, I am grumping at programmers who should know better. When newbies makes weird coding choices, that is simply them learning. That is obviously fine )
WOOOOOOO!
IF ALL GOES WELL IM GETTING TESTOSTERONE SOON
That's amazing! Big congratulations! I really hope everything goes well so that you can get started on it soon! ❤️

I love GDB (Gnu debugger). It is only useful when something have gone wrong, but GDB just makes it sooooo much easier to find the issue. The picture is of a particularly deep stack. It is a short overview of every stack-frame, and where in the code it was called from, and to what. I can also easily investigate every single stack frame alone, finding what each variable contained the moment the crash happened, what arguments each function took, and the memory position of every single element. By the way, to run this, all I did was: gdb ./build/MyAwesomeProgram run bt
If you work in C or C++, it is SUCH a handy tool to know. And it is pre-installed on basically every machine.
I just downloaded a program, as a git repository. It allowed you to have it work in several different ways. Which was achieved by simply using "git checkout" to check out whatever branch you want. I love it. That is so smart!
A beginners guide to GIT: Part 3 - How to learn GIT after (or instead of ) this guide
Table of content: Part 1: What is GIT? Why should I care?
Part 2: Definitions of terms and concepts

Part 3: How to learn GIT after (or instead of ) this guide.
Part 4: How to use GIT as 1 person

Part 5: How to use GIT as a group.

First of all, GIT have a website:
And besides downloading GIT if you do not already have it, it has THE GIT book. It is honestly very good and contains quite a few translations
Second, GIT is one of the old pieces of tech. This means that it is open source, free, and that it contains its own documentation and guides.
If you are ever stuck, or confused about something in GIT, you can use the help command.
Simply writing
git help
Shows you the porcelain commands, and tells you that adding the option -a like so:
git help -a
gives you ALL commands
and the option -g gives you all the guides the manual have, like so
git help -g
If you give help another command,, it will bring you to the manual page for that command
for example, someone on the internet told you to write
git help reset --hard
and you want to know what that means before running it? Write
git help reset
And you will be shown the manual page for “reset”. Including what --hard does. (To understand the manual, you need to understand the concepts and terms from part 2.)
If you want more visual explanations, Atlassian's guides are public and also quite good (But , remember. Atlassian uses Bitbucket. Bitbucket is 99% GIT, but can still have tiny differences)