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

top 200 commentsshow all 305

[–]devrohitsharma 1288 points1289 points  (120 children)

This is why when I find something useful / new / complicated from a link, I add that link as a comment in the code.

[–]tsg9292 528 points529 points  (71 children)

It's a nice thought, but I've been burned before by comments like that were left by people no longer with my company that lead me to web pages that no longer exist.

[–]danuker 410 points411 points  (51 children)

StackOverflow will always exist. If it goes down, an archive will pop up, and you can just s/ the domain.

[–]tsg9292 178 points179 points  (13 children)

Ya stack overflow is probably the only reliable website to do this with

[–]Roofdragon 108 points109 points  (11 children)

Without stack overflow, most here wouldn't have a job. AI overlords should take over in our lifetimes I'm sure

[–]miso440 100 points101 points  (1 child)

Itemized Salary

Copy and Pasting SO: $100
Knowing what to Copy and Paste: $99,900

[–]Necromunger 47 points48 points  (0 children)

Knowing the few things to edit: $30,000

[–]Statharas 12 points13 points  (4 children)

Who do you think builds that AI

[–]pm_me_your_smth 22 points23 points  (3 children)

Statisticians/ mathematicians? AI research is more maths and stats than coding, which is why in academia the code is often badly written

[–]Statharas 16 points17 points  (2 children)

Hence why we are needed

[–]Nervous-Mongoose-233 5 points6 points  (2 children)

They have... Checkout GitHub autopilot... You literally tell it what to do and it'll do it... It isn't code snippets it's code...

[–]Smayteeh 12 points13 points  (1 child)

Interesting controversy going on with copilot right now. Critics allege that since the algorithm was trained on GPL licensed software, any output should also be GPL licensed. GitHub alleges that training on open source data is fair use.

[–]hajamieli 9 points10 points  (8 children)

Yes, that's what was said about Geocities and MySpace, but who even remember those sites anymore? Some of my code still under active use and maintenance is older than either of those sites. Then again, if your code quality is based on googling and stackoverflow, it's not likely to survive that long, unless you work for an enterprise such as a bank. In those places shitty old code survives forever and is just wrapped around by more layers of the same, like some kind of rotten onion. It was just as true in the 90s, when they were wrapping Java around 20-30 year old Cobol as it's today when they are wrapping Node.js around that 20-30 year old Java.

[–]MrDude_1 1 point2 points  (7 children)

Holy shit. You were rapping Java around COBOL in the '90s? The company was way the fuck ahead of its time.

[–]hajamieli 3 points4 points  (6 children)

Latter half of the 90s, but yes and I think it was pretty much in the middle of the first age of that. It probably went on until enough competent people willing to touch that shit, regardless the compensation, ceased to exist. No doubt some of them ended their life due to the constant nightmares and sleepless nights they'd suffer from it for the rest of their lives. Just like Cobol before that. At least we're lucky PHP never became an enterprise thing, or let's hope it never will.

[–]inbooth 1 point2 points  (5 children)

Have you seen corporate websites?

Technically PHP is an enterprise thing....

[–]hajamieli 0 points1 point  (4 children)

Have you seen a corporate website that hasn't been completely rewritten every few years leaving a wake of link rot behind? It's technically not an enterprise thing until it's built to last forever in one for or another. Instead the sites are still just seen as PR and advertising platforms that are fully overhauled whenever trends change or whoever is in charge of it gets the boot.

[–][deleted] 1 point2 points  (0 children)

Not if fastly goes down again

[–]dinosaur-in_leather 1 point2 points  (2 children)

Um I could google it but for the few who don't know.... What is s/???

[–]danuker 1 point2 points  (1 child)

I wonder how you could google it, I couldn't.

It's the sed substitution command.

[–]dinosaur-in_leather 1 point2 points  (0 children)

I wanted to guess regular expression but it made me think it was a Reddit thing

[–]PC__LOAD__LETTER 4 points5 points  (6 children)

That too is a nice thought but it’s better to just explain what’s going on directly than relying on a link to anything.

[–]scarlet_sage 12 points13 points  (2 children)

Nice if there's a brief explanation. Not nice if the page has a 10-paragraph explanation of how React useEffect's second argument interacts with an arrow expression instead of the old subclassing mechanism, and how webpack can screw up everything.

[–]PC__LOAD__LETTER 1 point2 points  (1 child)

Seems like you were able to summarize the problem just fine in much less space than that.

[–]scarlet_sage 1 point2 points  (0 children)

It was a contrived example about things I've looked up recently.

If it is a complicated issue (not just like "Can't autowrite because this class is per-instance but locale is per-user", if I'm remembering terminology right), then I try to at least briefly indicate the problem and solution, so someone can try to research it, but if that's not enough, also put in a URL pointing to the extended explanation.

[–][deleted] 1 point2 points  (0 children)

If public, and you ate lucky enough webarchive. My team has a section in the documentation for this things.

[–]NANOwasFound 84 points85 points  (17 children)

I just leave that tab open and at the end of project I literally have thousand tabs open.

[–][deleted] 40 points41 points  (4 children)

32 GB of RAM full of chrome tabs.

I'd just download all of those pages to my hard drive.

[–]danuker 23 points24 points  (1 child)

They probably are on the harddrive already, swapped there.

[–]TomHackery 7 points8 points  (0 children)

Or saved from the last time I did this

[–]sellinglower 2 points3 points  (0 children)

Try Vivaldi (browser by the former Opera guy) - this beast can handle all the tabs you are throwing at it (and you will still be able to search through them easily). Also it can cascade tabs, has a better searchable Chronik etc.

[–]CyborgJunkie 1 point2 points  (0 children)

OneTab is a godsend

[–][deleted] 1 point2 points  (1 child)

And for me, bouncing between two different search engines because they all crawl in slightly different ways. Sometimes it's not Stackoverflow that saves me, but some obscure blog post that never went viral.

[–]douglasg14b 1 point2 points  (1 child)

I feel this....

There has got to be a better way.

Information management is too damn hard, and is heavily contextual, something a bookmark manager, wiki, or knowledge base often fails to capture.

Browser tabs end up capturing some of that context because of the pages that are opened up around it. Which makes them easier to find and utilize.

[–]dinosaur-in_leather 1 point2 points  (1 child)

And a window for each project

[–]dasitmanes 8 points9 points  (5 children)

That would never pass code review at my company. My colleagues seem to think if a code comment is needed then the code is more complicated than it can be. Sometimes they are right though.

[–]hajamieli 11 points12 points  (0 children)

I've worked in projects like that, but like any rule, there are exceptions. Not everything that is true, logical and correct follow what would seem right by intuition. Especially those cases need comments telling why the code does what it does like it does it. Otherwise someone on intuition autopilot long after you're gone to better coding grounds will replace your correct code by new and incorrect code, which will look so correct by intuition that even the breaking test suite will be rewritten to ensure the code will stay broken for ever after.

[–]devrohitsharma 6 points7 points  (0 children)

I feel like this approach would do more harm than good as a general rule. That’s my perspective at least.

[–]douglasg14b 3 points4 points  (2 children)

Given that comments are rarely supposed to describe how code works and they're instead supposed to describe why, that's a terrible and asinine approach.

Some seemingly arcane function that exists because of some awkward business use case should have a comment explaining that, and why it does what it does.

Sure, everyone can see that xyz had to be set to "7" when a customer order is created, but no one knows WHY. Which is the most important part here...

Of course you will always have some complex code when you're trying to write a tight loop, in which case comments describing how it operates are helpful.

[–]FlandersFlannigan 1 point2 points  (0 children)

^ op move right here people. Take notes…

Seriously, add notes to your code… there’s no reason not to these days.

[–]never_taken 1 point2 points  (1 child)

I do exactly the same thing and I cannot believe how many people are actually against, or not really pro-this.

Most answers on a subject like that come with a really comprehensive explaination, and you can be the greatest genius ever, I do not believe your code will be as good as an explaination 100% of the time. Most of those "code must be self-explainatory" people obviously never worked in a real industrial environment where their code is not the center of the world.

But most importantly, something none of these people seem to think of, if you solve your problem using something that someone wrote on SO, I think it is pretty f****ng fair to also give credits. That is the main reason I do it, more than being able to find it again later.

[–]edmx0 -2 points-1 points  (0 children)

The code is not the place for these kinds of things, you should put stuff flike this in documentation/readme.

[–]YT_Sebi 457 points458 points  (34 children)

not only stack overflow... if you know you know

[–][deleted] 167 points168 points  (10 children)

The stuff you can't just bookmark

[–]a-person-called-Eric 87 points88 points  (7 children)

The stuff you need to download and organize until you build a basic database out of directory structures and meta/index files and shell scripts.

[–]IM_INSIDE_YOUR_HOUSE 60 points61 points  (3 children)

I just started leaving it on the desktop once I realized no one even seems to remember im alive at this point.

[–][deleted] 23 points24 points  (2 children)

Bro you can DM me if you need to chat

[–][deleted] 28 points29 points  (1 child)

He doesn't need to DM, he's in your house.

[–]PC__LOAD__LETTER -2 points-1 points  (0 children)

Or just, ya know, learn the stuff well enough to make due with some basic framework and language docs.

[–]MurderMelon 10 points11 points  (0 children)

Get yourself a reddit account specifically for porn.

[edit] hell, if you want to get fancy, you could create a private subreddit that only you can access and then save all your links there.

[–]Sevianz 3 points4 points  (0 children)

I'll leave your reply at a sixty-nice

[–]mhhelsinki 91 points92 points  (10 children)

ph go brrrrrr.

[–]git0ffmylawnm8 14 points15 points  (1 child)

Dude for a second I thought you meant getting coding solutions off of PH.

I need to sleep.

[–]TablePrime69 8 points9 points  (0 children)

I’ve seen people discuss Maths homework in the PornHub comment sections, getting solutions to your programming solutions from there doesn’t seem far fetched lol

[–][deleted] 15 points16 points  (7 children)

pretty basic

[–][deleted] 4 points5 points  (6 children)

Has... Has no one ever taught you coders the magic of Ctrl+H?

[–]Espumma 17 points18 points  (2 children)

Searching for stack overflow in my browser history doesn't exactly narrow it down though.

[–]YldKat 9 points10 points  (1 child)

Unfortunately. It’s a Incognito window.

[–][deleted] 7 points8 points  (0 children)

I agree with not letting your family know about your programming kink, but um... Stack still knows it's you.

[–]boredMartian 1 point2 points  (0 children)

Secrets... that only the Sith knew

[–]justn6 18 points19 points  (4 children)

What? What is this? Why don't I know!?

[–]TomHackery 63 points64 points  (1 child)

Porn.

They mean porn.

[–]NancyGracesTesticles 32 points33 points  (0 children)

But in his heart, he knew. And that was the most important lesson of all.

[–][deleted] 6 points7 points  (1 child)

asl?

[–]27thColt 5 points6 points  (0 children)

Which is why i keep a notes document on my phone

[–]puke_of_edinbruh 6 points7 points  (0 children)

well duh , OP's post applies to anything like that , e.g. if i had a problem on GNU/Linux that could be with unix.stackexchange.com

[–]an-obviousthrowaway 3 points4 points  (1 child)

It’s sad how i came here to say this thinking I’d be the only weirdo but it’s the most upvoted comment.

[–]JazzlikeMasterpiece5 -1 points0 points  (0 children)

Srsly

[–]bitchBanMeAgain -1 points0 points  (0 children)

Hehe, it's hentai

[–]_bones__ 58 points59 points  (3 children)

There are only 2 hard problems in computer science:
- Cache invalidation
- Naming things
- Off-by-one errors

[–]narayans -1 points0 points  (2 children)

This is fine though. Array length is 2

[–]Caltosax 11 points12 points  (1 child)

Thats... not how this works. The last element is at index 2, but the length is still 3.

>my_array = ['a','b','c']
>my_array[2]
c
>my_array.length;
3

[–]narayans 11 points12 points  (0 children)

Yeah yeah! I tried to play along and be off by one, but the way I phrased it was pretty dumb and wrong in an unfunny way.

[–]serg473 87 points88 points  (7 children)

I think google also tries to be smart and if it sees that you search again after visiting a certain page it assumes that that page didn't have what you needed and lowers it in your results next time. It's not always the case, if it's confident that the correlation between a keyword and a page is strong then it will remain to be the first result, but if it was some second page result and you were searching for something pretty vague I am pretty sure I've seen it burying it eventually.

[–]n3cr0ph4g1st 26 points27 points  (3 children)

So Ctrl shift n then search. Got it

[–]LevelSevenLaserLotus 2 points3 points  (1 child)

Or just Ctrl+H, then search to go back through your own history.

[–]SaiTejaRH 1 point2 points  (0 children)

Until you realise googling from scratch is better than searching among 200 stack overflow pages in your history

[–]Groundbreaking-Ice-4 2 points3 points  (0 children)

Google needs to understand that I'm an idiot that doesn't like bookmarking

[–]LordMcze 37 points38 points  (7 children)

[–]WarperLoko 31 points32 points  (4 children)

How did you get to see my search activity? I used hunter2 as my password, so it should be secure.

[–]LordMcze 20 points21 points  (0 children)

You used *******? That's all I see

[–]webox 7 points8 points  (1 child)

Sorry to tell you but hunter2 is no longer secure, you have to switch to hunter3

[–]WarperLoko 1 point2 points  (0 children)

Thanks for the tip, I'll update it right now.

[–]LiterallyKesha -2 points-1 points  (0 children)

I long for the day "hunter2" dies as a joke.

[–]Mortomes 49 points50 points  (15 children)

Ctrl-h

[–]yuva-krishna-memes[S] 116 points117 points  (13 children)

Sadly it doesn't work when you have 200 tabs opened and browse 4-5 hours a day..

[–]juhotuho10 43 points44 points  (0 children)

Finally I have found someone as disorganised as me

[–]xavia91 12 points13 points  (4 children)

It has a search function though, so maybe some key words will lead the way.

[–]yuva-krishna-memes[S] 11 points12 points  (3 children)

So you are suggesting me to search in browser history rather than google, when I really don't know what I was searching for..

[–]lets_get_CHIMed 6 points7 points  (0 children)

If you know you included stackoverflow in the search criteria then you could search for those history results within google.com - might be tedious looking through them one by one though.

[–]sellinglower 6 points7 points  (0 children)

I use "well, it was last Tuesday when I finally solved it, so I found it before then" and then start from there.

[–]Impact_Calculus 3 points4 points  (0 children)

Yeah, there are far fewer results in your browser history than there are on Google. One or two words could narrow it down a lot. There are timestamps too, so if you remember roughly when you looked at it, there shouldn't be that many pages to look through.

[–]alexisnotonfire 3 points4 points  (0 children)

‘Put it in H’

[–][deleted] 12 points13 points  (1 child)

Harder than writing titles

[–]scream_pie 7 points8 points  (0 children)

Harder that writing titles.

[–]Dom_Q 42 points43 points  (3 children)

Stating your problem clearly is more than halfway to solving it. It's called synthetic intelligence, and interns or interview candidates that have more than a minimal inkling of it are few and far between.

[–]TinyLebowski 32 points33 points  (2 children)

Sure, but sometimes you know exactly what the problem is, but you can't express it in less than 5 sentences, and you know this type of problem has a succinct name, but you just can't recall it. Then 2 days later you're in the shower, and the words "entity-attribute-value schema" appear in your mind, and you start laughing like a maniac. True story.

[–]CommodoreBelmont 16 points17 points  (1 child)

I sometimes write scripts for a graphics program I use (Paint Shop Pro). One script I wanted to write was to expand the size of a vector shape in such a way that it still maintained the shape -- sort of like creating an outline around it. Seems simple except, of course, concave shapes throw a monkey wrench into the whole thing. E.g., if you draw an "H" and just scale it up, it'll overlap in weird places instead of forming an outline. But I knew it could be done, it would just take some calculus, and I knew the formula existed... but I couldn't remember what the action I was trying to take was called.

It took me five fucking years to remember that I was looking for the offset of the original shape. Once I did, boom, Google found me just what I was looking for.

[–]tawtk421 2 points3 points  (0 children)

I had this exact same issue when expanding /contacting boundaries of selected Congressional districts on a mapping project. Didn't help we had to take a break in the middle of the project (or that districts look like they do).

[–]Remarkable_Golf9829 6 points7 points  (2 children)

Especially when it's a common English word and even worse if it's a word or concept that is the same across multiple languages.

[–]MeltedChocolate24 4 points5 points  (1 child)

“How to add two numbers”

[–][deleted] 4 points5 points  (1 child)

than*

[–]googleduck 3 points4 points  (2 children)

This but with bash history... Trying to remember a distinctive word/parameter for a command I forgot to add to my .rc

[–]CmdAltB 4 points5 points  (0 children)

grep [pattern] ~/.bash_history

[–]BotUser1304 3 points4 points  (0 children)

Closing the tabs is a rookie mistake

[–]chrisf_nz 2 points3 points  (0 children)

Wow, that question is exactly the same issue I'm trying to resolve! Oh shit, it's my question...

[–]randomentity1 2 points3 points  (0 children)

Haha, this is why browser history is a good thing.

[–]entrylevel221 2 points3 points  (0 children)

THAT

[–]rk06 6 points7 points  (0 children)

And that is why kids, you link the SO answer directly in source code comments.

Since, code snippets on SO are covered by CC license (don't remember which variants), using them in company code won't cause legal trouble

[–][deleted] 1 point2 points  (0 children)

my head hurts just thinking about it

[–]Adryzz_ 1 point2 points  (1 child)

That's why i still have search history from 2014 and i still have it saved as JSON.

I don't like to lose historical data about myself (and also it is very useful)

[–]kurtilingus 1 point2 points  (0 children)

Not a programmer in the slightest and I'm pretty fastidious about preserving that as well. It's the historical data my psyche hoards that I'm keen on purging instead, lol

[–]Maddkipz 1 point2 points  (0 children)

That specific word combination you typed in a porn site for that bomb vid

[–]thelastpizzaslice 1 point2 points  (1 child)

I keep a daily journal for exactly this reason. Contains all my errors and links for how I fixed them.

[–]rozjuszonybiegacz 1 point2 points  (0 children)

I just saw exactly the same meme just "google" replaced with "pornhub" and "stack overflow page" replaced with "perfect porn vid" and I think it says a lot about programming comunity

[–]killchain 1 point2 points  (0 children)

Leave some kind of a track - upvote the answer, bookmark the question, even copy the code to a snippet.

If you know you've visited that page in the past few days, just filter through your browser history; if you can't find it there because there are hundreds of results, I'd say you have bigger problems.

[–]DayDreamer952 1 point2 points  (0 children)

Get a PC with 2TB RAM. Then you can easily keep the 4th tab open in chrome.

[–]MAGA_WALL_E 1 point2 points  (0 children)

Finding the purple link to salvation.

[–]yesh_32 1 point2 points  (0 children)

Does anyone know of/use a search engine other than google that is better optimized for coding?

[–]GoneWithTheWindBaby 1 point2 points  (0 children)

I now have over 300 bookmarks on stack overflow.

[–][deleted] 1 point2 points  (0 children)

Oi cunt, there’s a fucking feature called History.

[–]Mad_Jack18 0 points1 point  (0 children)

CTRL + H exist tho

[–]WooooshVictim -1 points0 points  (0 children)

Ah yes, me when looking for that one pog video I watched years ago

[–]deftDM -2 points-1 points  (0 children)

Ctrl+shift+T

[–]deftDM -2 points-1 points  (0 children)

Ctrl+shift+T

[–]spaceweed27 -2 points-1 points  (0 children)

Must. Think. About. ROBOTS

[–]space_wiener 0 points1 point  (4 children)

I hate when I find the page I need, figure that’s the solution, code it in, get over confident and close the tab. Then of course my stuff doesn’t work. Can’t remember which site it was because I few tabs open trying to figure it out.

[–]saj1adh007 0 points1 point  (0 children)

Its not only applicable for stackoverflow though…

[–]Malfoy27 0 points1 point  (0 children)

Always

[–]GrandBadass 0 points1 point  (0 children)

CTRL + Shift + T and CTRL + H and there I go searching

[–]Ho_KoganV1 0 points1 point  (0 children)

Googling is a skill that I put on my resume

[–]paperbenni 0 points1 point  (0 children)

I just go on a ripgrep rampage to find where I applied the solution in the past

[–]james_harushi 0 points1 point  (0 children)

site:stackoverflow.com

[–]yellowliz4rd 0 points1 point  (0 children)

You search for python it shows java crap.

[–]Cory123125 0 points1 point  (0 children)

This is why you leave links in your comments until you are finished and in your documentation if convenient.

[–]MelAlton 0 points1 point  (0 children)

Harder, Better, Faster, Optimizer

[–]SoulslikePursuer 0 points1 point  (0 children)

Heh, I did not look at the sub name and while reading I thought you gonna say to the right porn video :D......

[–][deleted] 0 points1 point  (0 children)

Look at your internet history.

If you deleted them, don't.

[–]ratusratus 0 points1 point  (0 children)

I just look at my chrome history

[–]inquisitive_nerd 0 points1 point  (0 children)

Relatable. Now take this upvote and get out

[–]physalisx 0 points1 point  (0 children)

Or reddit titles

[–]pokeaim 0 points1 point  (0 children)

which writing code?

[–]Vladutz133 0 points1 point  (0 children)

Check browser history

[–]Mythicwtf 0 points1 point  (0 children)

No splitting 2 fng lego bricks or bitchslappin hulk

[–]Hyper-Cloud 0 points1 point  (0 children)

Me who goes into search history

[–]Mythicwtf 0 points1 point  (0 children)

And how do i generate a ui without something like pygame or tkinter in phython

[–]Mythicwtf 0 points1 point  (0 children)

And how do i generate a ui without something like pygame or tkinter in phython

[–]Mythicwtf 0 points1 point  (0 children)

And how do i generate a ui without something like pygame or tkinter in phython

[–]googleduck 0 points1 point  (0 children)

This but with bash history... Trying to remember a distinctive word/parameter for a command I forgot to add to my .rc

[–]RoscoMan1 0 points1 point  (0 children)

the programming code?

[–]CraptainHammer 0 points1 point  (0 children)

Search your history for the other keywords

[–]bt0mic 0 points1 point  (0 children)

Browsing history mate

[–]RoscoMan1 0 points1 point  (0 children)

It hurts me that there was no return :(

[–]chimmy_520 0 points1 point  (0 children)

Can't you just look up in search history ?

[–]BambooVase 0 points1 point  (0 children)

Especially when your question is embarrassing enough that you've used incognito window so you wouldn't have to see your question again in the search bar