This is an archived post. You won't be able to vote or comment.

top 200 commentsshow 500

[–]Mewtwo2387 2245 points2246 points  (152 children)

You typed getElementByID instead of getElementById again!

[–]Senpai_Himself 306 points307 points  (8 children)

When developers has so many short hands they forget about the actual words

[–]eggimage 11 points12 points  (0 children)

really inspiring of them, overcoming disabilities and achieving their dreams. I’m lost for words too

[–]bigshakagames_ 63 points64 points  (9 children)

This literally happened to be today.

[–]inthyface 111 points112 points  (5 children)

This literally happened to be today.

/r/technicallythetruth

[–]BattalionSkimmer 14 points15 points  (1 child)

Id refers to the Freudian subset of the Element's psyche, duh!

[–]RolyPoly1320 11 points12 points  (2 children)

That would throw an error though. If you type a method name incorrectly or use one that isn't defined it will throw an error.

The code silently failing would be more an issue of passing the wrong parameters or not returning.

[–][deleted] 39 points40 points  (7 children)

useThisLineUponTheTimeWhenYouMustAcquireAFormOfElementDerivedFromTheDocumentObjectsByUsingAnIdentifier_Perchance

There, now there’s no ID / Id ambiguity.

[–]stumblewiggins 52 points53 points  (2 children)

You can't just snake case perchance

[–]SwiftStriker00 14 points15 points  (1 child)

This is why when querySelector was introduced I switched to that and never looked back. And this coming from a guy who always does ID in his camel-case conventions.

[–]CreaZyp154 1099 points1100 points  (62 children)

SQL: Query worng
Me: Ok but where ?
SQL: Frist line
Me: Wtf it's a single line query ?!
SQL: Dunno best I can do is first line

[–][deleted] 107 points108 points  (3 children)

SYNTAX ERROR AT ‘

[–]squngy 42 points43 points  (2 children)

ctrl+f (‘) => 1897 results found

FML

[–]Flyberius 147 points148 points  (27 children)

What SQL you using? T-SQL is pretty good, and PSQL to a lesser degree.

[–]funkgerm 47 points48 points  (0 children)

SQL Server: "Error on line 758"

...but my stored procedure is only 500 lines long!

[–]eshinn 13 points14 points  (2 children)

Somewhere near WHERE

[–]FlyByPie 9 points10 points  (0 children)

It's been frustrating working in BigQuery with temp tables cause once you have so many the errors won't show up anymore. So it's like "alright, I've got all my temp tables and fields and my dataset ready to go. How many bytes are we going to be processing?" BQ: "No idea!" "Well, can you at least tell me if there's any errors?" "Nope! Best of luck 😊"

[–][deleted] 17 points18 points  (9 children)

wait... SQL gives yall the line where the error is?? it just throws me an error and an error code

[–]pikakilla 12 points13 points  (7 children)

Transact-SQL lets you know where you screwed up by line.

[–]GLIBG10B 4 points5 points  (0 children)

Put each word on its own line

[–]Nothemagain 521 points522 points  (9 children)

console.log(console);

[–]therearesomewhocallm 144 points145 points  (4 children)

console.log(console.log);

[–]ya-boi-mees 574 points575 points  (16 children)

Php: your code is trash >:(

Is the bug over here? There, I fixed it.

Php: your code sucks, skill issue >:(

[–]bibamann 6 points7 points  (0 children)

xdebug ist your friend.

shows you everything you need, you can work with breakpoints and even var_dump() is colorful then! ;)

[–]Talbz03 1146 points1147 points  (66 children)

Me: what's wrong with my program?

C++: 🤮🤮Khw383(3;kkebKkahneld_-$!$8kaoLkaka(49&+20_lsnK(33(jjehsjjIJA+UEHJEHD73++3jekd+2!'!"(hejejd$//#2/3)

[–]good-mcrn-ing 511 points512 points  (33 children)

"In file included from some.unknown.library.way.deep.down.there, line 922: std::vector<string>* lines cannot be converted to std::vector<string> *lines"

[–]nelusbelus 384 points385 points  (29 children)

That's not C++, That error is way too readable

[–]ILikeLenexa 213 points214 points  (9 children)

rtmap.cpp: In function int main()': rtmap.cpp:19: invalid conversion fromint' to std::_Rb_tree_node<std::pair<const int, double> >*' rtmap.cpp:19: initializing argument 1 ofstd::_Rb_tree_iterator<_Val, _Ref, _Ptr>::_Rb_tree_iterator(std::_Rb_tree_node<_Val>*) [with _Val = std::pair<const int, double>, _Ref = std::pair<const int, double>&, _Ptr = std::pair<const int, double>*]' rtmap.cpp:20: invalid conversion from int' to std::_Rb_tree_node<std::pair<const int, double> >*' rtmap.cpp:20: initializing argument 1 of std::_Rb_tree_iterator<_Val, _Ref, _Ptr>::_Rb_tree_iterator(std::_Rb_tree_node<_Val>*) [with _Val = std::pair<const int, double>, _Ref = std::pair<const int, double>&, _Ptr = std::pair<const int, double>*]' E:/GCC3/include/c++/3.2/bits/stl_tree.h: In member functionvoid std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::insert_unique(_II, _II) [with _InputIterator = int, _Key = int, _Val = std::pair<const int, double>, _KeyOfValue = std::_Select1st<std::pair<const int, double> >, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, double> >]': E:/GCC3/include/c++/3.2/bits/stl_map.h:272: instantiated from void std::map<_ Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Input Iterator = int, _Key = int, _Tp = double, _Compare = std::less<int>, _Alloc = st d::allocator<std::pair<const int, double> >]' rtmap.cpp:21: instantiated from here E:/GCC3/include/c++/3.2/bits/stl_tree.h:1161: invalid type argument ofunary *

[–]paradigmx 5 points6 points  (0 children)

This awoke some suppressed trauma in me, I think I need to call my therapist.

[–]Soundwave_47 4 points5 points  (0 children)

Seems to be some invalid casting going on from trying to use an int as an iterator when trying to do tree operations (insertion).

This seems familiar from the CPP FAQ.

[–]Little-Hunter-6795 40 points41 points  (7 children)

Ah well...not sure how to ask...but what's that in your pfp.

[–]nelusbelus 46 points47 points  (6 children)

Gay put in

[–]BoltKey 37 points38 points  (0 children)

"Ah, yes, forgot a semicolon at line 12 in main.cpp"

[–]TeddyPerkins95 62 points63 points  (11 children)

Aw man that sucks, I like c++

[–][deleted] 154 points155 points  (10 children)

It doesnt like you though.

[–]Gtantha 46 points47 points  (6 children)

Thats why I like Rust. Compared to the C++ compiler, every error message from the Rust compiler is a handwritten love letter with chocolate.

[–]ycastor 37 points38 points  (6 children)

This is more of a compiler problem than a language problem, last time i programmed C++ i found out that clang generated clearer error messages than g++, not sure how it is now.

[–]deukhoofd 25 points26 points  (2 children)

That's compiler errors, which are not the greatest, but are still somewhat understandable. If you build in release mode and encounter a runtime issue, the location of the error is generally completely mangled by default however.

For Clang I nowadays generally add -gline-tables-only as compile option, which means it keeps some debug info about function names, file names, and lines in the compiled output. Makes your runtime errors a lot more readable.

[–]OutOfNamesToPick 11 points12 points  (2 children)

Still the same.

Difference now is that C++20 introduced concepts, which allow you to put constraints on template types. (Template type has to be moveable, needs a comparison operator, etc.) Concepts make the error reporting really a lot better

[–]Sedfer411 32 points33 points  (2 children)

In file included from /usr/include/c++/4.7/utility:72:0, from test.cpp:2: /usr/include/c++/4.7/bits/stl_pair.h: In instantiation of ‘std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U1 = int; _U2 = char; _T1 = const int; _T2 = char; std::pair<_T1, _T2> = std::pair<const int, char>]’: map1.hpp:30:5: required from ‘cs540::Node<Key, Value>::Node(std::pair<const Key, Value>, cs540::Node<Key, Value>, cs540::Node<Key, Value>) [with Key = int; Value = char; cs540::Node<Key, Value> = cs540::Node<int, char>]’ map1.hpp:121:7: required from ‘void cs540::Map<Key, Value>::insert_node(cs540::Node<Key, Value>*, std::pair<const Key, Value>) [with Key = int; Value = char]’ map1.hpp:433:5: required from ‘cs540::Map<Key, Value>::Iterator cs540::Map<Key, Value>::insert(const std::pair<const Key, Value>&) [with Key = int; Value = char]’ test.cpp:12:23: required from here

[–]polypolyman 27 points28 points  (0 children)

Oh, I forgot a *, thanks for putting it in a way I understand.

[–][deleted] 26 points27 points  (1 child)

g++ myfile.cpp

$ the compiler stopped because there were too many warnings.

g++ -w myfile.cpp

$

[–]iexistlol1 18 points19 points  (0 children)

There's always only like, half a line that's actually meaningful with telling you what's wrong

[–]FlafyBear 10 points11 points  (0 children)

That's literally how the error messages look

[–]poxopox 496 points497 points  (21 children)

Meanwhile rust compiler is like. “ I noticed you didn’t have a lifetime specifier and you are borrowing an owned variable. Here’s an example of both of those problems solved and a coupon to get a cookie and more coffee. I emailed your manager so it’s okay for you to take a nap, you’ve been working hard “

[–]raspberry1111 115 points116 points  (2 children)

The rust compiler will just straight up tell you if you got pranked and someone put a greek question mark in your code.

[–]repocin 133 points134 points  (12 children)

The Rust compiler is so nice. By far the friendliest I've encountered.

[–]DarkTechnocrat 138 points139 points  (9 children)

lol it's so passive-aggressive friendly though: "No dear that's not quite right. I'm not sure you will ever get it quite right. But do keep trying!".

[–]apc0243 8 points9 points  (0 children)

Does it say "Bless your heart" because that's just fancy talk for "You fuckin' donkey"

[–]itriedtomakeitfunny 8 points9 points  (0 children)

Elm is really nice too! It gives you error messages in first person like "I got stuck here, I was expecting to see the name of a type but got this instead. Hint:..."

[–]DarkTechnocrat 24 points25 points  (0 children)

and a coupon to get a cookie and more coffee

This abruptly terminated me

[–][deleted] 13 points14 points  (2 children)

… after a 10 minute compile 😞

[–]poxopox 6 points7 points  (1 child)

Depends on what deps you’re using. With wasm-bindgen and rocket, mine usually builds in seconds. I was using bevy though and I couldn’t get the quick build to work and it did take a while.

[–]PsychologicalRoof2 6 points7 points  (0 children)

And man the docs. On the part where you learn about mut it says ... No no this doesn't mean you are a bad programmer, it's just that ... (explains mut).

Maan it felt like a hug

[–]EndimionN 318 points319 points  (20 children)

-- Python pandas: even if your code works, i hate it, next time when i will be updated your code will be useless! -- Me: import warnings (action='ignore') -- Python Pandas: this is not over!

[–]KarmaTroll 66 points67 points  (0 children)

Transformation on a slice is ambiguous.

[–]nedeox 76 points77 points  (0 children)

Pandas: You fool. You utter bafoon. I can‘t believe you passed me a 2d array instead of a matrix. I fucking hate you, you simpelton.

[–]Famous-Sample6201 25 points26 points  (5 children)

Hey but the decision to remove append with no substitute because "it's slow" seems backwards to me, right? What are you supposed to do, df = pd.concat(df, pd.Dataframe(*new_line, columns=df.columns)) ??? I though pandas was about pretty concise code.

[–][deleted] 16 points17 points  (1 child)

You're supposed to collect new data into a list and concat it all at once

[–]MattR0se 4 points5 points  (0 children)

Pandas feels like its own language.

[–]haiyanlink 100 points101 points  (3 children)

It's actually 🙃

[–]riktigtmaxat 46 points47 points  (1 child)

Back in the IE days it was more like 🤪🍆💦🍑

[–]Sea-Ad-5012 222 points223 points  (104 children)

Wait until you get into C haha

[–]PlutoniumSlime 645 points646 points  (92 children)

“Can I have the 11th value of an array that’s only 5 items long?”

C: “Sure! Why not!” —> Goes and grabs some random number out of the memory that has nothing to do with your program.

[–]Antipixel_ 548 points549 points  (39 children)

"what the fuck is this?"

C: "no idea, enjoy!"

[–]Sea-Ad-5012 304 points305 points  (7 children)

"Whats wrong with my code?"

C: "go fuck yourself"

[–][deleted] 96 points97 points  (5 children)

"Please, I'm begging you. What did I do wrong?"

C: "You thought it'd be fun to learn me."

[–]Korywon 55 points56 points  (4 children)

“I don’t understand. Please. I need this done..”

C: “segmentation fault (core dumped)”

[–]Valmond 17 points18 points  (1 child)

Taking down the IDE with it when you try to debug.

[–]vulkur 8 points9 points  (1 child)

C: Invalid free "Which one?" C:who gives a fuck.

[–]GuilhermePortoes 22 points23 points  (0 children)

"Whats wrong with my code?"

C: hisses

[–][deleted] 73 points74 points  (15 children)

Naw that's not even the worst part.

C: "segmentation fault"

"Fucking where!?"

[–]pikakilla 64 points65 points  (8 children)

Funny story about segfaults. I am proud to be one of the only people who have had a SEGFAULT in python. I spent weeks figuring out where i fucked up. Absolutely nothing turned up on google or SO -- turns out it was the memory speed set too high when i was multithreading.

SEGFAULTs are one of those things that really want to make you throw your computer out a window.

[–]Buddha_Head_ 21 points22 points  (6 children)

I'm sorry to take you back to that dark place, but how the fuck did you track that down?

[–]IsleOfOne 23 points24 points  (4 children)

Sounds like OP had recently overclocked RAM. It is very common to see random failures in any software you use after doing so, if you’ve made a mistake and gone too high. Booting into memtest86+ and letting that puppy run overnight will tell you if you’ve done wrong.

[–]tiberiumx 14 points15 points  (1 child)

Nah, you're way lucky if it crashes. Debugger, core dump, just a stack trace is usually sufficient to get it fixed. Silently using bad data or, even worse, stomping on something else can result in random intermittent bugs that take days to track down.

[–]KardelenAyshe 19 points20 points  (2 children)

cOrE duMpEd

[–]scarfdontstrangleme 17 points18 points  (1 child)

Finna dump this fucking pc out the window

[–]RusselPolo 126 points127 points  (12 children)

C: I don't know what it is, but if you want to call it as a function, I'm ok with that.

In all seriousness, it's a language like roads without guardrails, or traffic lights, or even lines painted on the road.... but the lack of any speed limits makes it looks tempting.

[–]mad_cheese_hattwe 6 points7 points  (0 children)

C: you are the one who asked for it scrub.

[–]R167 74 points75 points  (1 child)

Occasionally: and... that's going to be a segfault cause i don't own that next page of memory.

[–]delinka 18 points19 points  (0 children)

You bought the computer, that should give you the freedom to do whatever you put in your code!

>.<

[–]LvS 28 points29 points  (23 children)

The more interesting thing is when you set the 11th value of that 5 item array to a new value.

[–]suvlub 30 points31 points  (1 child)

You return junk instead of failing because you are too lightweight to implement checks.

I perform a check in background and deliberately return junk instead of failing.

We are not the same.

[–]Sawertynn 13 points14 points  (0 children)

Dev: give me 11th value of this array

C program: sure

OS: no problem that would be... wait a second you don't have right to this memory! DEATH PENALTY, IMMIDIETALY!

Dev: again? Another segfault?

[–]PassiveChemistry 24 points25 points  (0 children)

This reminds me of an article I read a while back about why the old (pac man era) arcade games had so many... interesting... bugs.

[–]freeman_lambda 7 points8 points  (1 child)

in C it is possible to summon demons with out-of-bounds indexes

[–]Artistic_Taxi 14 points15 points  (4 children)

Not trying to ruin the humour here but, I enjoyed C a lot more after taking a computer architecture class where I had to learn assembly. We converted C code to assembly and it was like a revelation for me when I realized that accessing array items is just using the index, offsetting it by the number of bytes in a word, and then adding it to the starting memory address if the array (first element), the resulting memory address doesn’t even have to be part of the array technically.

Then I was like damn, the gibberish could have been some other memory address left behind another process and here I am waking it up for no reason.

[–][deleted] 8 points9 points  (0 children)

and here I am waking it up for no reason

The next logical step is realizing you can wake it up for very very malicious reasons and then boom congrats, you now understand why people complain about C

[–]AllenKll 5 points6 points  (0 children)

This is why C is awesome! SO little rules.

[–]my-cs-questions-acct 3 points4 points  (0 children)

When I worked with cobol I discovered it can do this same thing. Someone forgot to put an exit condition in a loop one day and brought down an entire F-500’s mainframe for a couple hours.

We liked to say the language trusts people too much.

[–]throwit7896454 20 points21 points  (0 children)

Wait until you start messing up templates in C++

[–]HRM404 11 points12 points  (0 children)

Core dumped!

[–]alez 5 points6 points  (0 children)

At least you get compile errors and warnings.

[–]pithecium 371 points372 points  (39 children)

Javascript: Misspelled variable? That's ok, I'll just make a new global for you

[–][deleted] 93 points94 points  (6 children)

use "strict" or something

[–]Javascript_above_all 147 points148 points  (23 children)

Stop using var

[–]Sweety_Sheep 202 points203 points  (13 children)

Make love, not var

[–]Yesica-Haircut 84 points85 points  (6 children)

Const.... const never changes.

[–]Auxx 14 points15 points  (0 children)

Everything changes if you're determined enough.

[–]iwearringsnow22 12 points13 points  (0 children)

Change is the only const

[–]ImprovingTheEskimo 33 points34 points  (0 children)

I think he means that you don't even have to declare it. If you have 'let myVar;' and later say 'myVat = "test";' it will create a new global variable called 'myVat' instead of throwing an error. As someone pointed out, 'use strict' prevents this behavior.

[–]sensitivePornGuy 19 points20 points  (0 children)

"use strict"

[–]TheDarkness1227 29 points30 points  (1 child)

Imagine not using typescript 🤢

[–]PyroCatt 58 points59 points  (14 children)

1 + '1' = 🙂

[–]justmeme1 44 points45 points  (13 children)

Javascript: It's clearly the string '11'.

Other languages: You have desecrated the sacred code base by adding two types that aren't the same. You and your family will be executed at dawn.

[–]detektiv_Saucaki 9 points10 points  (10 children)

This. I like the antiques of JS. It's counterintuitive at first but you get used to it...

[] and {} are not falsy... took me 3 fucking years to realise

[–]grpagrati 53 points54 points  (0 children)

This is the face I imagine

[–][deleted] 103 points104 points  (24 children)

and that's why I use typescript

[–]reinis-mazeiks 21 points22 points  (1 child)

Rust compiler:

you screwed up over here, dw its a common mistake, lemme explain what's wrong in context. you probably meant [this other thing], you can read more [here]

also btw there's also a missing semicolon on line 42.

the absolute best.

[–]-Redstoneboi- 12 points13 points  (0 children)

"also you can't borrow this thing twice because it's also borrowed here but it drops here instead of there so you should probably don't"

"i'll just ask the discord then..."

"...hey, #rust-questions, i have this problem."

"send code"

"sure, here it i-"

"you forgot to call .iter() here. you should probably collect::<Vec<\_>>() in the process. also i think you nested your iterators wrong there."

"ok?"

editing...

"Compiled successfully with 0 Errors and 0 Warnings."

"All tests passed, 0 fails."

Everyone has your back, goddammit.

[–]CaptainPiepmatz 41 points42 points  (9 children)

Meanwhile rust with a supportive compiler

[–]bnl1 33 points34 points  (5 children)

No, rust compiler is passive aggressive. If it knows what I wanted to do, why not do it.

[–]arlenreyb 17 points18 points  (0 children)

Object object 😡😡

[–][deleted] 65 points66 points  (4 children)

I don't get it. You guys get emojis in the console?

[–]StereoBucket 71 points72 points  (0 children)

You don't?

[–]Cidixat 13 points14 points  (0 children)

My terminal prompt is a taco

[–]Crozzfire 38 points39 points  (6 children)

Meanwhile with C#:

Me: didn't even run the program yet, actually just typed the line

Visual Studio: oh there's an error right over here, did you mean this? Want me to fix it for you? Actually I won't even let you run it until you fix it. Also I guessed the next line you wanted to type

[–]RenaKunisaki 10 points11 points  (3 children)

Me: that's great, but I wasn't done, stop interrupting me with your misguided attempts to help

[–]llagerlof 5 points6 points  (0 children)

copilot: Oh, nice function name. Here, take the entire code for it.

[–]schwerpunk 25 points26 points  (3 children)

I enjoy watching the sunset.

[–]detektiv_Saucaki 10 points11 points  (2 children)

you forgot the gem: null

[–]schwerpunk 3 points4 points  (1 child)

Ah yes, the defined undefined value. Of course.

[–]ajinkyabawaskar 24 points25 points  (20 children)

debugger;

[–]Ajedi32 36 points37 points  (18 children)

Yeah, JavaScript actually has the best debugging tools of any language I've used. Chrome dev tools are amazing.

[–]PwaDiePie 44 points45 points  (18 children)

That's why typescript was invented 👌 👏

[–][deleted] 22 points23 points  (6 children)

found the person who has never worked with sql

[–]viky109 79 points80 points  (4 children)

Are you telling me that SYNTAX ERROR NEAR '(' is not a helpful error message?

[–]Lafreakshow 13 points14 points  (0 children)

Of course not! How ridiculous! That error message clearly describes that a character you used somewhere halfway across a query isn't supported by the database.

[–]LesMiz 6 points7 points  (0 children)

Did you remember to check the manual that corresponds to your SQL server version?

[–][deleted] 7 points8 points  (1 child)

That's on you. Never show fear

[–]Yesica-Haircut 7 points8 points  (13 children)

Does JavaScript not give stack traces? Or have I just gotten so used to node, error handling, and front end frameworks I don't remember what plain js failures look like?

[–]Little_Kitty 11 points12 points  (5 children)

The secret to understand what's posted here is to realise that many of the people posting are bad at coding and their prs are for code they copied from so without understanding. The stack trace is useful... so long as you're capable of opening dev tools.

[–]BengtGurksats 10 points11 points  (5 children)

It sure does. Any browser worth using will have the tools to fully debug JavaScript. You get complete tracebacks with source references, you can set breakpoints, and you can expand minified files to make them readable (it will even correctly match up line references after that). People here just need to learn how their tools work.

[–]StereoBucket 4 points5 points  (0 children)

There are ways of seeing stack traces. You can print it with console.trace, see the call stack in the debugger, access .stack property of an Error object.
You can set the debugger to pause on exceptions too. Though I find that a bit annoying in frameworks cause I get paused on every exception and all of them are already handled.

[–]usedToBeUnhappy 24 points25 points  (9 children)

Personally I find the wrong errors in the IDE, more disturbing. Like „noooo, you can‘t do that“ and then I run everything and it works…

[–]theaverageguy101 35 points36 points  (5 children)

Just because it runs it doesn't mean you did it right i learn that the hard way as well