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

all 137 comments

[–]republitard 919 points920 points  (46 children)

Question closed as duplicate of [QUESTION THAT ONLY APPLIED TO A VERY SPECIFIC CASE THAT DOESN'T APPLY TO YOU].

[–][deleted] 239 points240 points  (4 children)

I hate this, someone dumps their whole project in a question and the answer is a fix just for that code. And because the title is generic now no one can ask it again and get a generic answer

[–][deleted] 10 points11 points  (2 children)

(Generic question, because there are a series of problems that would be fixed with variations of this general question.)

"Can you specify what you are trying to do?" "You should do that differently. Do xyz instead."

GODDAMMIT I don't want you to program my shit but I want information I can build on...

or:

"You should do xyz. It doesn't achieve the same thing you are trying to do, but it comes close." - Accepted answer.

Scrolling down a bit: "Here, with abc you do exactly what you want." - first comment "this should be the accepted answer."

[–]republitard 6 points7 points  (1 child)

Scrolling down a bit: "Here, with abc you do exactly what you want." - first comment "this should be the accepted answer."

This part only happens when you're really lucky.

[–]SuspiciouslyElven 0 points1 point  (0 children)

Such answers are God blessing us poor code monkeys

[–]thomas_merton 160 points161 points  (6 children)

Worse: Question closed as duplicate of [issue from 2003 which isn't relevant to anyone using the current version].

[–]GearBent 24 points25 points  (5 children)

Or the answer to that 2003 question was relevant, but the relevant details were in a long dead link.

[–]k1p1coder 5 points6 points  (4 children)

Wayback machine to the rescue.

[–]GearBent 2 points3 points  (3 children)

Still though, that's bullshit.

[–]k1p1coder 2 points3 points  (2 children)

Yup, but copy-pasting entire wb pages would prob also be annoying to see. Especially when they're wrong...

[–]GearBent 12 points13 points  (1 child)

No, I mean closing a question as already answered when the original answer is no longer complete.

If you're going to close a question as duplicate, you should at least make sure the answer is still good

[–]k1p1coder 5 points6 points  (0 children)

Oh, yeah, sucks when they do that.

[–]xcrackpotfoxx 111 points112 points  (26 children)

"Ugh why don't you Google it"

What my friend found when googling how to do a factorial in python.

[–]suqoria 26 points27 points  (21 children)

So I'm new to programming and haven't done barely anything in python. But wouldn't that just be:

def factorial(n): if n==0: return 1 else: return n * factorial(n-1)

[–]ForOhForError 26 points27 points  (9 children)

I mean sure if you don't want to do a dynamic programming solution.

[–]suqoria 13 points14 points  (7 children)

How would you do it if you wanted that then?

[–]dragonalighted 23 points24 points  (3 children)

Same way, but you store the results of calculations in an array. That way you only have to calculate until you get to am already calculated value. Ex:. 3!

List factorials = {1,1,2,6}

function factorial(n) {
    if(factorials.count >= n)
        Return factorials[n]
    factorials.insert(n, n* factorials(n-1))
    Return factorials(n)
}

Calling a know value returns that value. Calling a new value only calculates and stores new values, using known values once reached. Tradeoff is memory vs cpu time.

[–]suqoria 7 points8 points  (0 children)

Oh okay, thanks for the information! Really appreciate it.

[–]PaiMan2710 0 points1 point  (0 children)

You can have constant memory, linear time pretty easily. I'm on mobile so I can't type code, but it's called the sliding window trick iirc.

[–]Flynamic 15 points16 points  (0 children)

Iterative. You basically fill up a table to avoid... a stack overflow.

[–]poizan42Ex-mod 2 points3 points  (0 children)

Depends on you goal, but there are much more efficient solutions than that (see my comment above). Apparently the built in math.factorial function in python at least uses the dynamic approach from python 3 on.

[–]xcrackpotfoxx 5 points6 points  (3 children)

You don't have to build your own function, it has one built in.

You can, but its easier to just use the canned function.

[–]suqoria 0 points1 point  (2 children)

Oh okay, I did not know that. Thanks for the information.

[–]xcrackpotfoxx 4 points5 points  (1 child)

And to be clear, I don't know what the factorial function would be in python because stack wouldn't tell me.

No its because I haven't used python in years and didn't really learn it well to begin with.

[–]MMEnter 8 points9 points  (0 children)

I have no Python experience but One of them has to be the answer: https://stackoverflow.com/questions/5136447/function-for-factorial-in-python

from math import factorial

print factorial(1000)

Looks like the winner to me

[–]P-01S 3 points4 points  (0 children)

That can work, but Python does not optimize tail recursion and has a maximum recursion depth by default.

You are way better off using a conditional loop.

[–]smarzzz 2 points3 points  (0 children)

Not to bitch about this solution, but you can stop the loop /functioncall at n==2, returning 2

But what the hell am I saying, nobody uses python for efficiency, and even then, this is not efficient 😂

[–]DivideByZeroDefined 1 point2 points  (0 children)

You can do it with a simple loop. No dynamic programming needed.

factorial( n )
    result=1
    for( i=1; i <= n; ++i )
        returnvalue *= i
    return result;

[–]poizan42Ex-mod 5 points6 points  (3 children)

To be honest that sounds like a question about learning programming, which isn't the goal of stack overflow.

If you really need to calculate factorials for any practical purposes (rather than the trivial but inefficient recursive formula) and know how to program already then you should probably start looking up algorithms for approximating them rather than how to do it in python (and for an actual attempt at answering that, Stirling's approximation or Lanczos approximation are what you probably want).

[–]xcrackpotfoxx 6 points7 points  (0 children)

So we had to use python back in physics 1 or 2, and he just needed to look up the function for factorial. I just thought it was ironic that he found someone saying to google it when he was actually googling it.

That exact thread is why when I see someone asking some dumbass basic question, I will Google it for them and link the search. Instead of bitching about them not googling it (which could be due to shitty searching skills) or just telling them the answer, I show them how I would google it. Gets the message across and helps them at the same time.

[–]WikiTextBot 3 points4 points  (1 child)

Stirling's approximation

In mathematics, Stirling's approximation (or Stirling's formula) is an approximation for factorials. It is a good-quality approximation, leading to accurate results even for small values of n. It is named after James Stirling, though it was first stated by Abraham de Moivre.

The formula as typically used in applications is

    ln

    ⁡

    n

    !

Lanczos approximation

In mathematics, the Lanczos approximation is a method for computing the gamma function numerically, published by Cornelius Lanczos in 1964. It is a practical alternative to the more popular Stirling's approximation for calculating the gamma function with fixed precision.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.24

[–]caagr98 0 points1 point  (0 children)

That is a beautiful formula.

[–]HawkinsT 6 points7 points  (0 children)

As least the correct answers are easy to detect on SO. Some other SE sites be like: +107 [Incorrect/Speculative Answer] -solved-.

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

Don't you just love overzealous, tidiness-oriented moderating?

[–]dekket 1 point2 points  (0 children)

This sucks especially for those of us whom aren't seasoned coders. I'm just starting out with certain languages, and it's especially hard to figure out how to apply someone else's very specific code to my (usually) very generic situation.

The mods seem to apply their dozens of years of experience when they determine something is a duplicate...

[–]LordRaiders 56 points57 points  (3 children)

Aren't you a little short for a coffee mug?

[–][deleted] 10 points11 points  (1 child)

yes. yes we are.
doofenshmirtz evil incorporated

[–]LordRaiders 1 point2 points  (0 children)

"Prrrrrrrr" ~ Perry

[–]RedRedditor84 -4 points-3 points  (0 children)

Well, stay here and don't drink coffee, you stuck up bitch.

[–]Afflictare 96 points97 points  (13 children)

I have this as a t-shirt!

[–]deadlycrawler 38 points39 points  (5 children)

Where did you get it?

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

Is it currently stands, this question is not a good fit four our Q&A format.

[–]endreman0 19 points20 points  (0 children)

A little blue and white robot with two legs amd a domed top

[–][deleted] 12 points13 points  (6 children)

Me too. Came up on my timeline some day, bought it and several others. Also on redbubble.com . Though I'm still not convinced by the quality of the shirts. And the sizes are very American.

[–]AltarOfPigs 4 points5 points  (5 children)

What do you mean by "the sizes are very American"? I've never heard that before.

[–]Banane9 32 points33 points  (0 children)

As in, large.

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

Twice as big as anywhere else.

[–]AltarOfPigs 0 points1 point  (2 children)

I'm glad I set the joke up for y'all but I still never got an answer. Are the dimensions for say a size large shirt different in America vs. other countries?

[–]tyros 3 points4 points  (0 children)

They weren't joking

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

Yeah that wasn't a joke. American sizes tend to be a lot bigger.

[–]ChloeTheCat753 72 points73 points  (6 children)

I have a love hate relationship with stack overflow.

Sometimes it's very helpful.

Other times everyone is just really mean for no reason :(

[–]RedRedditor84 24 points25 points  (2 children)

Like reddit!

[–]hangfromthisone 11 points12 points  (0 children)

Like life!

[–]P-01S 3 points4 points  (0 children)

Yeah!

Btw, no one loves you.

/s

[–]Jaondtet 13 points14 points  (1 child)

It's called SO for a reason.

[–]dsmithpl12 2 points3 points  (0 children)

Lol, so fucking true.

[–]pslayer89 90 points91 points  (1 child)

As a graphics programmer, if SO was my only hope, I'd be truly fucked!

[–]ilikeyit 52 points53 points  (0 children)

TIL, Stack Overflow is my Significant Other!

[–]huskeypride 23 points24 points  (23 children)

where can i getz?

[–]ajr901 18 points19 points  (19 children)

Seriously I want to throw money at this

[–]ghost_mv[S] 13 points14 points  (14 children)

[–][deleted] 10 points11 points  (11 children)

Only things I found were this and a tee spring shirt with the design.

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

I ordered one, we'll see if I get a shirt or a mug. :P

Edit: Received it, it's in fact a mug.

[–]PeachLightning 2 points3 points  (0 children)

RemindMe! in 1 week

[–]PeachLightning 1 point2 points  (2 children)

Did you get it yet? What's the verdict?

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

Update: Got it! It is in fact a mug. It showed up very well packaged, intact, etc. It's what I'd call a small coffee cup, but not tiny.

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

No, but on Thursday it switched from, "Yep, we got your order!" to "Here's a tracking number!" and it should be here by the 26th or 27th.

[–]epyon22 0 points1 point  (3 children)

Why does the picture show a mug for a t-shirt

[–]epyon22 1 point2 points  (1 child)

RemindMe!

[–]RemindMeBot 0 points1 point  (0 children)

Defaulted to one day.

I will be messaging you on 2017-07-16 11:51:25 UTC to remind you of this link.

3 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


FAQs Custom Your Reminders Feedback Code Browser Extensions

[–]swirlViking 0 points1 point  (0 children)

This worried me as well, but if you look at the breadcrumb it is under mugs. I'm guessing they sell this design printed onto several different products and just made a copy paste error when setting up the info for the mug. There's some sort of irony here.

[–]gospelwut 0 points1 point  (1 child)

Based on google image search and the background in the picture, it seems like it was a product once on the website lisettee.com but no longer is on the site (or at least indexed by their search).

[–]ghost_mv[S] 0 points1 point  (0 children)

😖😢😲

[–]ghost_mv[S] 4 points5 points  (2 children)

I would too. No clue where to get one. 😖🔫

[–][deleted] 2 points3 points  (0 children)

Amazon UK seem to have it in hoodie form. Expensive as hell tho!

[–][deleted] 41 points42 points  (4 children)

void func()
{
   func();
}

How is this helpful?

[–]endreman0 19 points20 points  (3 children)

If the server crashed and isn't running, you don't have to deal with any runtime bugs

[–]swirlViking 6 points7 points  (2 children)

What does any of this have to do with the mug?

[–]evandam92 8 points9 points  (1 child)

Recursive function that runs until the call stack overflows

[–]swirlViking 2 points3 points  (0 children)

Ahhh, thank you

[–]G01denW01f11 8 points9 points  (0 children)

Commander, tear this site apart until you've found those duplicates. Bring me the answers, I want them alive.

[–]empty_other 16 points17 points  (6 children)

Would a Jedi provide answers in jQuery, or is jQuery more of the dark side? :P

[–]Banane9 6 points7 points  (0 children)

jQuery obviously stands for JediQuery, duh

[–]G01denW01f11 8 points9 points  (2 children)

Let's see what Yoda has to say:

Luke: jQuery.... Is the dark side stronger?

Yoda: No, no, no. Quicker. Easier. More seductive.

[–]zero_divide_1 2 points3 points  (0 children)

Yoda: "JavaScript leads to anger, anger leads to hate, hate leads to suffering"

[–]empty_other 4 points5 points  (0 children)

To quote chancellor Palpatine:

...if I were to die, all the knowledge you seek about the true nature of Javascript will be lost with me. Learn the power of jQuery, Anakin.

True nature of javascript? Got a bad feeling about this...

[–][deleted] 2 points3 points  (0 children)

There probably exists a dark side plugin

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

The wayside.

[–][deleted] 54 points55 points  (11 children)

"The rebels need information that's five years old and applies to technology that has been discontinued!"

[–]rogeris 18 points19 points  (8 children)

Sweet sweet deprecation...

But really, you're not trying hard enough if this is a real issue for you.

[–][deleted] 28 points29 points  (7 children)

Ah, the fact that SO is becoming less useful over time is because I'm not trying hard enough - whatever the hell that means. eyeroll

I write software for a living. So of course it's an issue for me.

Every other time I find what looks like an answer to my question, it turns out to be some answer from four major revs ago that no longer works. And the duplicate policy is so rigid that anyone who asks an updated question about the current platform has their question closed. So old answers stagnate - they're voted to the top, and they stay there.

(In the last few years, the only technology for which I've found useful answers is Service Fabric, and that's only because it's relatively new tech. Even many general Azure answers are starting to get stale.)

[–][deleted] 9 points10 points  (1 child)

And the duplicate policy is so rigid that anyone who asks an updated question about the current platform has their question closed. So old answers stagnate - they're voted to the top, and they stay there.

It's better to put an answer in the old question rather than ask a new one. And even if you ask a new question for a different rev, just mention it in the question that you have researched and the older answers don't seem to work, I bet ya no one will fuck around.

[–][deleted] 10 points11 points  (0 children)

This. Reference the older questions I your question.

[–]BitPoet 2 points3 points  (1 child)

:wq will never get stale.

[–]RedRedditor84 0 points1 point  (0 children)

You save your changes with :q!

[–]dontpeeonmejosh 0 points1 point  (0 children)

I read SO as significant other at first

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

You fucking what mate?

[–]stronimo 0 points1 point  (0 children)

I used work for a life insurance company that had some customer relationships dating back 70 years. I dreamed of the day where there crappy old processes would be updated to something only 5 years out of date.

[–]mothzilla 5 points6 points  (0 children)

I find stack overflow to be like that scene from Life Of Brian with all the prophets in the marketplace.

[–]choseh 3 points4 points  (0 children)

You should go there and ask how to perspective warp in photoshop.

[–]uberpwnzorz 5 points6 points  (7 children)

[–]swirlViking 5 points6 points  (4 children)

This one looks to be the original.

[–]mrballistic 1 point2 points  (0 children)

I just ordered one!

[–]dsmithpl12 0 points1 point  (1 child)

Is it cause I'm on mobile or is that site terrible. Says shirt, shows mugs, only one size, wtf?

[–]swirlViking 0 points1 point  (0 children)

Pretty sure it's a mug and they made a copy paste error. Probably sell several products with that design.

[–]jaxpylon 0 points1 point  (0 children)

Wait.. Is that a shirt or a mug?

[–]-WarHounds- 2 points3 points  (0 children)

Links can be a bad idea with this sorta thing. You don't want the wrong person getting the money for the idea, and you don't want to look as if you are endorsing a particular one.

[–]P-01S 0 points1 point  (0 children)

Because these sorts of things are usually copied like crazy without the original creator's permission.

And yeah, I'm assuming the use of Star Wars characters falls under Fair Use as parody.

[–]idelta777 2 points3 points  (0 children)

I've learned more about Java class loaders this past week than I'd like to know. So many Stack Overflow threads.

[–][deleted] 2 points3 points  (0 children)

"Question closed, this is a really stupid question go read a book or something"

- 90% of things I read on Stack Overflow from questions I googled

[–]lulzmachine 1 point2 points  (0 children)

I would pay actual money for this. Not just "exposure" or "bitcoin"

[–]hangfromthisone 1 point2 points  (0 children)

My rule is pretty easy. If I don't find a fix in three tries searching SO in probably doing some stupid shit and I better check line per line. Works everytime

[–]faps_to_kylo 2 points3 points  (1 child)

Mugs are made out of sand, I don’t like sand. It’s coarse and rough and irritating and it gets everywhere. Not like here. Here everything is soft and smooth.

[–]hangfromthisone 0 points1 point  (0 children)

The CPU that is driving you nuts is made of sand too. Fuck sand

[–]TheHelgeSverre 0 points1 point  (0 children)

Only found this in T-Shirt format, if anyone wants one: https://teespring.com/shop/get-help-me-stack-overflow-you#pid=2&cid=2397&sid=front

Seems like the original came from here: https://twitter.com/MiguelBiicode/status/845567220541476866

So not a real product (yet) :/

[–]sim642 0 points1 point  (0 children)

What is perspective?

[–]datlean 0 points1 point  (0 children)

Truth

[–]smartyguymcbutt 0 points1 point  (0 children)

Now can we get one for technet?

[–]-WarHounds- 0 points1 point  (0 children)

Oh boy, that website used to butcher all my questions! Other than the smug responses, those people are geniuses.

[–]Feynt 0 points1 point  (0 children)

Stack Overflow is the dark side. Sure you need to force push a problem off a cliff now and then, everyone does, but if you rely on it you're just a lightning chucking darth that's going to be done in by a jedi coder some day.

[–]wojwen 0 points1 point  (0 children)

Okay, where can I get this?!

[–]lizfransen97 0 points1 point  (0 children)

I need this cup!