Skip to content

Instantly share code, notes, and snippets.

@ccharles
Last active April 12, 2024 18:58
Show Gist options
  • Save ccharles/d625a895cf776a2ce7b33b9dbf004848 to your computer and use it in GitHub Desktop.
Save ccharles/d625a895cf776a2ce7b33b9dbf004848 to your computer and use it in GitHub Desktop.
Common Stack Overflow comments

Please read [Why should I not upload images of code/data/errors?](https://meta.stackoverflow.com/q/285551/354577) You can [edit] your question and replace the images with [code block]s. The easiest way to do this is to paste the code as text directly into your question, then select it and click the code block button.

USER, [please don't translate posts for other users](https://meta.stackoverflow.com/a/297680/354577): _"**Non-English questions should not be translated into English** by anyone other than the original poster (OP). Translating a question for a non-English speaker sets them and all participants up for a poor experience, due to the OP not being able to follow and respond to feedback from comments, understand answers, or get assistance from the Help Center."_ I'm rolling this back.

Note to reviewers: this is a request for _canonical documentation_. [It should not be closed as a recommendation request](https://meta.stackoverflow.com/q/385479/354577).

Please read [Why should I not upload images of code/data/errors?](https://meta.stackoverflow.com/q/285551/354577) and [Why should I provide a Minimal Reproducible Example for a very simple SQL query?](https://meta.stackoverflow.com/q/333952/354577)

Are you aware of our [policy forbidding AI-generated answers](https://meta.stackoverflow.com/q/421831/354577)? A warning should have appeared in the answer box where you typed (well, pasted) this answer.

Please read [Why is "Can someone help me?" not an actual question?](https://meta.stackoverflow.com/a/284237/354577)

Please don't repost questions: [How do I get attention for one of my own questions without a good answer?](https://meta.stackexchange.com/q/7046/248627)

Welcome to Stack Overflow. Please take the [tour]. This is a question-and-answer site, not a blogging platform. While [self-answers are permitted](https://stackoverflow.com/help/self-answer), all posts here must conform to the Q&A format. Please [edit] this into an on-topic question (see the [help/on-topic]) and then post your answer below. Make sure the question is actually on topic or it will be closed and deleted.

Code is a lot more helpful when it is accompanied by an explanation. Stack Overflow is about learning, not providing snippets to blindly copy and paste. Please [edit] your answer and explain how it answers the specific question being asked. See [answer].

Answers (and questions) should be written such that future users can learn from them, too. Please either [edit] this answer to provide details about what was wrong, or consider deleting your question entirely (I think you'll have to delete this answer first).

I'm voting to close this question because [we literally cannot help](https://meta.stackoverflow.com/q/255745/354577). Contact Heroku support. You might want to start [here](https://help.heroku.com/7IDU8QZZ/what-should-i-do-if-i-m-locked-out-of-my-heroku-account). (Note that this is exactly what MFA is supposed to do. If you can't provide a token, you can't log in. In the future I strongly suggest that you configure an alternate MFA source and / or save your recovery codes.)

XXX is _way_ above Heroku's slug size limit. I'm not familiar with that library, but lots of ML / NLP libraries include huge amounts of data. Assuming that's the case here, Heroku might not be the best fit for your application.

Please read [ask]. In particular: "**Post the question and respond to feedback** After you post, leave the question open in your browser for a bit, and see if anyone comments. If you missed an obvious piece of information, be ready to respond by editing your question to include it. If someone posts an answer, be ready to try it out and provide feedback!"

Python doesn't have dataframes. If you are using pandas, please always include the [tag:pandas] tag as described in the [tag:python] tag wiki: "When using a Python variant (e.g. Jython, PyPy) or library (e.g. Pandas, NumPy), please include it in the tags".

Please don't SHOUT AT US. If you need to emphasize something you can [do it with Markdown](https://stackoverflow.com/editing-help).

Welcome to Stack Overflow. Please take the [tour]. This is a question and answer site, not a discussion forum. This section is only for answers. Once you have earned 50 reputation points by asking and answering you will be able to [comment on other users' questions and answers](https://stackoverflow.com/help/privileges/comment).

Por favor, traduce su pregunta en inglés o pregunta otra ves en [es.so]. Aquí [hablamos](https://stackoverflow.blog/2009/07/23/non-english-question-policy/) solamente [inglés](https://meta.stackoverflow.com/a/297680/354577).

Please read [Under what circumstances may I add "urgent" or other similar phrases to my question, in order to obtain faster answers?](https://meta.stackoverflow.com/q/326569/354577) (TL;DR: It's never okay.)

Welcome to Stack Overflow. Please read [Open Letter to Students with Homework Problems](https://softwareengineering.meta.stackexchange.com/questions/6166/open-letter-to-students-with-homework-problems) and [Why is "Can someone help me?" not an actual question?](https://meta.stackoverflow.com/a/284237/354577). You can't just dump your problem statement here and expect us to do it for you. It's also a good idea to take the [tour], read about what's on-topic in the [help/on-topic], and [ask].

If you're writing new code, **_please_, for the love of all you hold dear, don't use the `mysql_*` functions!** They are old and broken, were deprecated in PHP 5.5, and completely removed in PHP 7.0 (which is so old it [no longer even receives active support](http://php.net/supported-versions.php)). Use [`PDO`](https://secure.php.net/manual/en/book.pdo.php) or [`mysqli_*`](https://secure.php.net/manual/en/book.mysqli.php) with _prepared statements_ and _parameter binding_ instead. See http://stackoverflow.com/q/12859942/354577 for details. It's _2022_. This isn't funny anymore.

Please don't roll your own password hashing solution. Use [`password_hash()`](https://secure.php.net/manual/en/function.password-hash.php) and [`password_verify()`](https://secure.php.net/manual/en/function.password-verify.php) instead.

If those are your real credentials you should invalidate them **_immediately_**. They are forever compromised, and you need to generate new ones. Editing them out of your question is _**not enough**_.

I added some basic formatting to your question so it's easier to read. Please review [Stack Overflow's formatting documentation](https://stackoverflow.com/help/formatting) so you can do this yourself next time.

I moved your problem statement before your code block. It's usually easier to digest code with some context. See [ask] for details.

I replaced your inline code markers (`\``) with a code block. The easiest way to format a code block on SO is to paste your code, then select it and press Ctrl+K or click the `{}` button. This indents the whole block by an additional four spaces, instructing Stack Overflow to format it as code.

Welcome to Stack Overflow. [HTTP 500](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_server_errors) is a generic server-side error message. On its own it doesn't tell us anything useful. Any time you see this your first step should be to check your error logs for more detail. On Heroku, you can do this by running [`heroku logs`](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-logs).

I copied your code into your question. It's fine to supplement your question with off-site resources, but the question itself should be self-contained.

[Here be dragons](http://stackoverflow.com/a/1732454/354577). While it may be possible to handle specific narrow use cases with regular expressions in general it is **_literally not possible_** to parse HTML with regex. It's almost always better to use a proper XML / HTML parser like [`DOMDocument`](https://secure.php.net/manual/en/class.domdocument.php) or an XML query language like [XPath](https://en.wikipedia.org/wiki/XPath).

This feels like an [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) to me. What are you trying to accomplish by doing this?

Were you able to get this working with any of the answers shown below? If so, please remember to [accept it](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) by clicking on the ✔. This shows other users that you've found a solution.

Your code is _**wide open** to [SQL injection](https://en.wikipedia.org/wiki/SQL_injection)_. Don't build queries by sticking strings together. Instead, use [prepared statements](http://php.net/manual/en/pdo.prepare.php) with [parameter binding](http://php.net/manual/en/pdostatement.bindparam.php).

What's the _exact_ error message? It's important to read those; they are usually designed to be helpful in finding and solving the problem.

You're welcome. Note that [there is no need to say "thank you" in a comment](https://meta.stackexchange.com/questions/126180/is-it-acceptable-to-write-a-thank-you-in-a-comment) on Stack Overflow. In fact, such comments are often removed by moderators (official ones as well as regular users who have earned certain [privileges](https://stackoverflow.com/help/privileges)). Accepting an answer, as you have done, and / or upvoting helpful answers after you've earned 15 reputation points, is the best way to show gratitude here.

_Please_ search for an answer before asking a question. This error message has already been explained many times on Stack Overflow.

Code is made of _text_. It should be shared _as text_, not as screenshots. Text can be copied and pasted into a text editor! Screenshots cannot :-(. Text can be efficiently searched! Screenshots cannot :-(. Text can be consumed by users of assistive technologies, like screenreaders! Screenshots cannot :-(. [Please give text the respect it deserves instead of banishing it to inaccessible image formats](https://meta.stackoverflow.com/a/285557/354577).

Please read about what's on-topic in the [help/on-topic]. Notably: "Questions asking us to _recommend or find a book, tool, software library, tutorial or other off-site resource_ are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, [describe the problem](http://meta.stackexchange.com/q/139399/) and what has been done so far to solve it."

[Please don't add "solved" to your title or question](https://meta.stackexchange.com/a/116105/248627). Instead, [mark an answer correct by clicking on the checkmark](https://meta.stackexchange.com/q/5234/248627). You can also [add your own answer](https://stackoverflow.com/help/self-answer) and accept it if none of the ones you received solved your problem.

[Please don't answer off-topic questions](https://meta.stackoverflow.com/a/276637/354577)

Welcome to Stack Overflow. I see that you haven't taken the [tour] yet. Please do that, then read about what's on-topic in the [help/on-topic] and then [ask]. This is far too broad and opinion-based to be on-topic here. Do you have any _specific_, _concrete_ questions?

Please read the [code of conduct](https://stackoverflow.com/conduct). Be nice.

'[Assume-unchanged should not be abused for an ignore mechanism. It is "I know my filesystem operations are slow. I'll promise Git that I won't change these paths by making them with that bit… Especially, it is *not* a promise by Git that Git will always consider these paths are unmodified—if Git can determine a path that is marked as assume-unchanged has changed without incurring extra lstat(2) cost, it reserves the right to report that the path *has been* modified (…`git commit -a` is free to commit that change).](https://public-inbox.org/git/xmqqy4z5go1y.fsf@gitster.dls.corp.google.com/)'

"All changes I make to it will be ignored"—[not true](https://public-inbox.org/git/xmqqy4z5go1y.fsf@gitster.dls.corp.google.com/): 'Assume-unchanged should not be abused for an ignore mechanism. It is "I know my filesystem operations are slow. **I'll promise Git that I _won't_ change these paths**…" Especially, it is *not* a promise… that Git will always consider these paths are unmodified—if Git can determine a path… has changed without incurring extra `lstat(2)` cost, it reserves the right to report that the path *has been* modified (…`git commit -a` is free to commit that change).'

Welcome to Stack Overflow. Questions here must be self-contained. We're not going to go off-site (or, worse, download an archive) and dig through your code for you. Please [edit] your question and copy the relevant code directly into it as a [mcve]. You can format it as code using the code block button with the code block selected.

Bienvenue à Stack Overflow. Ici on parle que l'anglais. S.v.p, traducez votre question en anglais. Autrefois on ne peut pas vous aider. Si vous preferez, on a aussi [pt.so], [es.so], [ru.so], et [ja.so].

[Please ask a single question at a time](https://meta.stackexchange.com/a/39224/248627)

Welcome to Stack Overflow. For a variety of reasons, [link-only answers are discouraged here](https://meta.stackexchange.com/a/8259/248627). Please edit your answer and include the main points directly in your question. See [answer].

Welcome to Stack Overflow. [This is](https://stackoverflow.blog/2009/07/23/non-english-question-policy/) an [English-language site](https://meta.stackoverflow.com/a/297680/354577). Please translate your question into English or use [pt.so].

Please don't write code for users if they don't provide their own attempt. We're not here to do people's homework (or job) for them. We're here to help them _learn_ and providing code to blindly copy and paste doesn't help with that.

_**Never** use `eval()` without a very good, very specific reason. It is an **ENORMOUS security vulnerability** to `eval()` untrusted input, even from an API. Attackers can make your computer do **literally anything**: send spam, distribute malware, destroy your operating system, download and distribute illegal material... Valid uses for `eval()` are **extremely rare**._

Have you tried looking at your logs, e.g. by running `heroku logs`, as that error page tells you to do? What do they say?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment