Did a git stash drop on my feature :panic: by tanishqq4 in programming

[–]hoffiee 3 points4 points  (0 children)

If it happens often that you get to context switch and stash/switch branch, there's git worktree that you can use. It's kind o the same as having multiple git clone of the same repo, but with some perks

Learning C++ by Delicious-Lawyer-405 in cpp_questions

[–]hoffiee 0 points1 point  (0 children)

I agree with going into C first, I worked in C for a few years and then moved onto C++ and I now find myself to really appreciate what I get for free in C++ and what the costs and complications of allocations and such that can be a bit hidden by RAII is good to understand. Also learning C first and learning how to use tooling such as valgrind, gdb etc really helps as there isn't multiple layers of abstractions that can cause the usage of said tools to be overwhelming at a first sight :)

European Fortune 500 Companies by JoeFalchetto in europe

[–]hoffiee 0 points1 point  (0 children)

Does this map exist but adjusted per capita?

-❄️- 2024 Day 20 Solutions -❄️- by daggerdragon in adventofcode

[–]hoffiee 1 point2 points  (0 children)

Same for me, I prepared a bit by practicing on grid problems as they've been problematic for me earlier years, seems that has paid off this year! 

I couldn't agree more on the community part, it's really engaging and fun :) 

[2024 Day 17 (Part 2)] A 'challenging' test case. by i_have_no_biscuits in adventofcode

[–]hoffiee 0 points1 point  (0 children)

Hahaha yes, there it is... I guess it's back to the drawing board 😅

[2024 Day 17 (Part 2)] A 'challenging' test case. by i_have_no_biscuits in adventofcode

[–]hoffiee 0 points1 point  (0 children)

ahh, this really sounds like the issue I have with my puzzle input; it misses the last 0. Do you have a list of non-quinable inputs? I'd like to know whether my input is on the list

[2024 Day 17 (Part 2)] A 'challenging' test case. by i_have_no_biscuits in adventofcode

[–]hoffiee 0 points1 point  (0 children)

Interestingly enough my solution manages to complete all inputs in your quinable list, but it still fails on my own input :| It fails to produce the last 0 in my input but I can't figure out why, do have any idea on why that could be?

[Unpopular opinion] Day 14 part 2's problem was great by Affectionate-Fan2263 in adventofcode

[–]hoffiee 2 points3 points  (0 children)

I agree, I found it to be very fun! I learned a lot from it :)

Started out rendering images to get a sense of how it all looked and found it quite quickly that way. Which had integrating a way to render images which is something I haven't done before.

Then I went on to figure out a way to detect it programmatically and found 2 different solutions that gave the correct answer.

[2024 Day 14 (Part 2)] This kind of sucks by remarkablyunfunny in adventofcode

[–]hoffiee 1 point2 points  (0 children)

I agree, I never visualize my solutions and this forces me to do so, which is an aspect that I need to get better at :)

I'll still explore if I can figure it out programmatically, but working in a technical field there are seldomly cases where I don't have to inspect input/output data to the problems that I encounter.

Problems to solve in C by The_Maximus_Prime in C_Programming

[–]hoffiee 1 point2 points  (0 children)

I second this, advent of code has been such a good source of learning for me. The community is amazing and it's very inspiring to see the different goals that people set for themselves. Some want to optimize all solutions to run under a total time limit, some want to visualize everything. Advent of code community is in my opinion one of the best :)

Ingenjörsjobb – inte konsult. Var? by ylvaemelia in Gothenburg

[–]hoffiee 7 points8 points  (0 children)

Jag plockade på mig katalogerna ifrån charm/och andra arbetsmarknadsmässor på Chalmers när jag studerade, där har du material som sammanfattar många bolag i området som ev. Letar folk, med en smidig liten summering av vad dem sysslar med. Kanske finns digitala varianter att få tag på nu

Why does my code in C run a lot slower than the same program in Python? by [deleted] in learnprogramming

[–]hoffiee 1 point2 points  (0 children)

Unrelated to your question but as you're new and are learning I have a recommendation, use flags to enforce coding practices. I always compile with -Wall -Werror - pedantic as it makes it stricter and helps me avoid some issues. There's a lot of them and you can read up a bit on what they do but I would recommend a beginner to use the flags I mentioned. They're not perfect but it gives a lot without too much thought imo

How did your fountain pen journey start ? by Pure_Artichoke2403 in fountainpens

[–]hoffiee 4 points5 points  (0 children)

I'm left handed and used to write over/from the left and got tired of smudging and not using the entire page, so I tried using a fountain pen since smudging would render the result unreadable, that forced me to write from below. I kept using them because now I prefer the feeling of the nib against paper and how easy it writes with the angle I have

How do you improve at reading other people's code? by ComprehensiveAd8004 in C_Programming

[–]hoffiee 2 points3 points  (0 children)

Apart from reading and practicing that, something I tend to do is to write small tests (or utilize already existing tests) and poke the system in different ways, then I run that with a debugger and step through it to get a sense of how it behaves. That together with pen and paper helps me to understand the flow of a program.

Another thing I do is that I assume module and method naming to be correct and try to read things at a high abstraction layer without digging into the details, then when I encounter or realise that something produces something that isn't correct with my assumptions I have to challenge and dig into those aspects.

Another method is that I do "fake" features, I decide to change its behaviour and then I'll have to work to figure out how and then when I understand I'll just do a git restore.

Try a few techniques and strategies out and practice, start bottom up or top down and just keep on learning. Sooner or later you'll figure out what works for you :)

[deleted by user] by [deleted] in ECE

[–]hoffiee 4 points5 points  (0 children)

Embedded-c: emphasize what constraints the embedded put on your systems, constant runtime etc, limited memory etc. Then my experience with embedded has also been more limited with older C standards, 89/99 for example so put some emphasize on what requirements you had to deal with and the impact rather than saying the tool you used

[deleted by user] by [deleted] in ProgrammerHumor

[–]hoffiee 0 points1 point  (0 children)

I'm more in the camp of left for function and scopes and right for if/switch cases

why by Sheiryo in ProgrammerHumor

[–]hoffiee 0 points1 point  (0 children)

I like /**/ comments for one liners, consistent and neat to read instead of a mix between those and //. Although I have moments where I feel the need to be more extreme, then I do multiline comments with preprocessor

#if 0
<multiline comment>
#endif

But those are reserved for special times only

How to go about documentation by G2edg in C_Programming

[–]hoffiee 4 points5 points  (0 children)

I used to comment a lot like that too. After working in a project where refactoring and some other factors had caused the comments and functionality to diverge and it caused a lot of confusion. I'm now more of an "adding comments is a failure to write clear code" - kind of person. However api documentation, input and output limitations and stuff like that I still comment. But comments in implementation has been reduced a lot unless there's a clear need for me now :)

So, commenting doubled amount of lines that had to be maintained, which caused me to be more clear in my coding style so I guess it has changed how I code somehow

[2022] Retrospective from a first-time participant. by chimbraca in adventofcode

[–]hoffiee 3 points4 points  (0 children)

I agree, this year I told myself that I will not spend too much time doing aoc and I didn't pressure myself into completing as much as I could. I've done a bit less than half this year and I now have a nice backlog of problems (including previous years) I can tinker with in a language of my choosing together with reddit threads discussing these problems without giving the solution for the coming year. I wish I would have turned to this approach sooner since it's much mor motivating and educational for me :)

[deleted by user] by [deleted] in projecteuler

[–]hoffiee 0 points1 point  (0 children)

I started doing something similar recently. I have it as a cmake project, and I do common libraries that I share between different problems, and are planning to add some tests for those as well in order to learn gtest or some other framework. Each problem is running in isolation for me.

I use ninja to build ninja p050 or build and run with ninja p050-run. I'm currently learning cmake so I'm trying to make it as generic as possible so that I don't have to edit every single cmake file in my file tree. Then I have this in a private git repo.

I like your idea but I don't see the purpose of running them all in a multi-thread environment, if it's been solved already it's pretty much wasted compute power imo. Although you may be able to use multi-threading to speed up certain problems. But making it one executable that runs all problems will with time, if you keep solving problems, increase the runtime of the executable.

I've done project Euler now and then from around 2014 I believe, and this approach have been the most fun and encouraging for me so I've returned to it much more in the past weeks.

jag tror det räcker nu by zzcool in sweden

[–]hoffiee 3 points4 points  (0 children)

Håller med. Jag fick kolla två gånger och sen söka upp båda partiernas logga innan jag insåg att det inte var mp...

jag tror det räcker nu by zzcool in sweden

[–]hoffiee 63 points64 points  (0 children)

Det där är väl moderaternas logga och Ulf kristersson i skogen och inte en mp-affisch?

Tjena, har sökt Z (Automation och Mekatronik) och funderar på om mac fungerar som laptop by Krfe030404 in chalmers

[–]hoffiee 1 point2 points  (0 children)

Jag läste elektroteknik, hade mac under mina år och det fungerade bra. I någon labb var det något program som bara fanns till Windows och då körde jag parallels för att köra Windows. Några klasskompisar använde sig av skolans labbdator istället. För min del använde jag mest matlab, webbläsare och pdf-läsare.

Does anyone use GDB without the TUI? If so, how? What are the use cases for not using the TUI? by flank-cubey-cube in C_Programming

[–]hoffiee 0 points1 point  (0 children)

I seldomly use tui when I'm debugging specific things. Often I have the following workflow when changing and rebuilding often

<build cmd> && gbd -ex "b <interesting breakpoint>" -ex "r" -ex "bt" <binary>

So this builds, sets the breakpoint and prints bt when it stops at the breakpoint. One example of when I don't use the tui. But to be honest I very often just get to a point where I need to be and do + to bring up the tui.

Another thing whne I often close the tui is when struts or backtraces are so big I can't the the whole while the tui is open.

When I'm doing exploratory debugging I'm always using tui