Details
-
AboutEverything electronic enthusiast, professional web developer
-
Skillsphp, python, js, java
Joined devRant on 1/2/2019
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
-
fork() can fail: this is important
Ah, fork(). The way processes make more processes. Well, one of them, anyway. It seems I have another story to tell about it.
It can fail. Got that? Are you taking this seriously? You should. fork can fail. Just like malloc, it can fail. Neither of them fail often, but when they do, you can't just ignore it. You have to do something intelligent about it.
People seem to know that fork will return 0 if you're the child and some positive number if you're the parent -- that number is the child's pid. They sock this number away and then use it later.
Guess what happens when you don't test for failure? Yep, that's right, you probably treat "-1" (fork's error result) as a pid.
That's the beginning of the pain. The true pain comes later when it's time to send a signal. Maybe you want to shut down a child process.
Do you kill(pid, signal)? Maybe you do kill(pid, 9).
Do you know what happens when pid is -1? You really should. It's Important. Yes, with a capital I.
...
...
...
Here, I'll paste from the kill(2) man page on my Linux box.
If pid equals -1, then sig is sent to every process for which the calling process has permission to send signals, except for process 1 (init), ...
See that? Killing "pid -1" is equivalent to massacring every other process you are permitted to signal. If you're root, that's probably everything. You live and init lives, but that's it. Everything else is gone gone gone.
Do you have code which manages processes? Have you ever found a machine totally dead except for the text console getty/login (which are respawned by init, naturally) and the process manager? Did you blame the oomkiller in the kernel?
It might not be the guilty party here. Go see if you killed -1.
Unix: just enough potholes and bear traps to keep an entire valley going.
Source: https://rachelbythebay.com/w/2014/...12 -
All the stupid date functions where the days range from 1 to 31 but the months range from 0 to 1120
-
Hi there! I am new to this community. Can someone tell how it works and what is the purpose of this community?19
-
One of my first projects involved a python server. This was before I even knew about CD/CI, so we were updating by ssh-ing in, pulling, and killing the process.
My solution? Make an endpoint that pulls the repo and intentionally crashes the server to restart it. We used it for two years.1 -
"hey i want to print hello world to the terminal, can someone help me?"
>You should use ai for this, construct a neural network and feed it data.
>node has a great framework for printing to the terminal, use npm i termprinter && tp create-app
>*20 line bash script with esoteric unix tools nobodys heard of*
>hey i did this in unity, heres a link to my 30 minute long youtube tutorial
I somehow feel like the barrier of entry for programming has been lowered way too drastically.10 -
cat > /dev/null
I use it to take notes during meetings, they are temporary in the terminal so I am forced to polish them afterwards2 -
Rant !dev
Come on.... That's just misleading... Shouldn't be allowed to put that in fine print... That requires pressing View Details to see...
OTOH... Incognito...22 -
My boss just declared that every first Friday of every month would be LAN Party night. We bring our own PC or console or whatever and just play games all night (after work). Boss man will bring food. It's optional of course but god damn this is soooo good3
-
devRant Bot Registry
The aim of this Collab is to put together a list of all known devRant-Bots to ensure that all bots can be setup to ignore each other. [more details]30 -
C is like an obsidian razor. Extremely sharp tool, immense power with immense responsibility. You can make art and you can make bloody mess.
Clojure is like a magic rainbow mist. You accept it and it's pure chrysalis, everything is good, everything is fine. You feel cared about, you feel like nothing can hurt you.
Bash is like feeling your stepdad's finger inside your asshole. Shame and shame again combined with extreme perception of wrongdoing that lead to nothing but psychological trauma.1 -
Multi-Screen problem: So I need to run a VR headset with a laptop, and the laptop has only one hdmi connection. I don't have any extra hdmi adapters, so I cannot connect my second screen while working with the headset, which sucks...
but...
then it hit me...
there is an app called spacedesk which allows you to use your phone as an additional screen. I have a docking station for my phone so I can connect hmdi to it. On the first try the resolution was shit since it uses the default phone resolution. But the phone has Samsung Dex, which allows you to run everything full screen on your connected screen, so I can run the app within Samsung Dex and therefore will get full resolution.
And this works. It's kinda stupid and maybe a bit complicated, but it works. God, I love technology :D:D:D
This is the adapter to adapter to adapter to adapter meme in action, just wireless. Lol. I'm proud of this xD5 -
Climb into bed, feel something wet under leg. Wtf? I check. Bloody slug...
There was freaking slug in my bed...
Clean it out, change sheets and all (at 4am, I got lost in the code) and then see another one climbing up the side of the bed27 -
My mom (a single mother who had to feed 4 kids) feed me, let me stay in her house (at least until I was 21) and let me use the motorcycle.
Instead of running away and giving up her children to child institution (because that's probably what I will do being a selfish person that I am)
If that's not support, I don't know what that is anymore.
It might not be much but at least it gave me the time to grew up and be independent to pursue my dream of working in IT.
Her strength and toughness facing the hard life is also the main inspiration for me to keep going, to prove that I can do whatever I want if I put enough effort on it.1 -
I had good support.
I got access to a computer at 10 when my mother brought home the ones they used for education to avoid them being stolen
That was a couple of sinclair ZX80
I the got to go to 5 different programming courses over the next 4 years before being able to get a summer job at 14 to by my own spectravideo 128.
At 1) I started teaching through mother job and at 18 I wrote my first commercial program for my father.
I am now 50 and still in the business:)3 -
There is quite possibly nothing more irritating than getting a message every couple of hours from your product owner titled - "How are you going with the task?"9
-
I just fucking despise working on someone else's code and it's filled with errors like "reciever" instead of "receiver" or "mesasge" instead of "message"...
it fucking leads to an astonishing amount of fucking errors just because I know how to write english words AND I'M ITALIAN WTF18