Details
-
AboutProgramming is part problem-solving and part choosing future problems. Nothing is holy and nothing should be held sacred. Not a paradigm; not a language; not conventions; and DEFINITELY not a way of thinking.
-
SkillsPython, Rust, C++, Spftware Engineer.
-
LocationIsrael
Joined devRant on 2/21/2018
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
-
I love the idea of automating day to day activities in hacky ways (e.g. the beginning of back to the future).
-
Like one of those jobs that demand 12 years of experience with Kubernetes (which was released 6 years ago)6
-
HOW TRANSIT SHOULD WORK
🚌 🏃
🚌 🏃
🚌 🏃
💨 🏃
🚶♂️ oh fuck I missed the bus
🚶♂️ glad there's another in 6 minutes!
HOW TRANSIT DOES WORK (IN THE US)
🚌 🏃
🚌 🏃
🚌 🏃
💨🏃
🚶♂️ oh fuck I missed the bus
🚶♂️ not another for an hour
🚶♂️ hope I don't lose my job.15 -
My girlfriend is amazing:
After a long uphill battle trying to finish a huge open source project I started months ago. She noticed I was getting a little deflated.
So she donated a small amount to the donation page to lift my spirits.
She wanted to do it secretly but didn't know that it wasnt anonymous.
The little things spur us on.40 -
So I'm writing some multithreaded shit in C that is supposed to work cross-platform. MingW has Posix threads for Windows, so that saved already half of the platform dependency. The other half was that these threads need to run external programs.
Well, there's system(), right? Uhm yes, but it sucks. It's incredibly slow on Windows, and it looks like you can have only one system() call ongoing at the same time. Which kinda defeats the multithreaded driver. Ok, but there's CreateProcessA(), and that doesn't suck.
Fine, now for Linux. The fork/exec hack is quite ugly, but it works and is even fast. Just never use fork() without immediate exec(). First try under Cygwin... crap I fork bombed my system! What is this shit? Ah I fucked up the path names so that the external executable couldn't be run.
Lesson learnt: put an exit() right after the exec() in the path for child process. Should never be reached, but if it goes there, the exit() at least prevents a fork bomb.
Well yeah, sort of works under Cygwin, but only with up to 3 threads. Beyond that, it seems like fork() at some point gives two processes the same PID, and then shit hangs.
Even slapping a mutex around the fork and releasing it only in the parent process didn't help. Fork in Cygwin is like a fork in the ass. posix_spawn() should work better because it can be mapped more easily to the Windows model, but still no dice.
OK, testing under real Linux. Yeah, no issues with that one! But instead, I get some obscure "free(): invalid size" abort. What the fuck would that even mean?! Checking my free() calls: all fine.
Time to fire up GDB in the terminal! Put a catch on the abort signal, mh got just hex data. Shit I forgot to compile with -O0 and -g. Next try. Backtrace shows the full call trace, back to the originating line in my program - which is fclose() on a file.
Ahhh I remember! Under Linux, fclosing a file that is already closed makes the program crash. So probably I was closing it twice. Checking back.. yeah that's where it was.
Shit runs fast on several cores now!8 -
The 3 greatest things in life:
1 A great orgasm
2. A great shit
3. Fixing a major bug before anyone notices.
Work directly on a production system and get all 3 experiences simultaneously.8 -
What technology/concept/programming language did you learn that made you feel way way more brilliant?
Me: Shell scripting, feel like god 😌18 -
Found this on r/ProgrammerHumor and thought I'd share it on here as my first post. Looking forward to getting to know the community. It's cool to see a community of like-minded people!5