Hot answers tagged

15

As lunboks notes you can search code blocks with the code: search term. e.g. code:"new" So you should be able to use user:me code:"new" to find what you're looking for. It doesn't appear to search bodies or titles, but I couldn't find any documentation for it.


15

I reproduced that onTwitterInit : function () { if (window.twttr) { var that = this; window.twttr.anywhere(function (T) {
 doesn't get rendered properly in the preview: The culprit is a Unicode character (code 8232) following the { on the last line. If you remove it, the rendering problems disappears. U+2028 is the Unicode ...


14

This is not recommended. Stack Overflow is not your personal debugging service. Ideally you should narrow your problem down to a simple, isolated section of code. Something we could try for ourselves without having to wade through your entire project. This also means that if you have a large project, you should not include all your sources within your post. ...


12

The merits or demerits of a code-only answer is a different matter. But constraining answers to pseudocode would detract from a large majority of answers and add little or no value. Most importantly (in my opinion), the ability to get a specific answer to a specific question would be lost. Sometimes even experienced developers want to be able to cut-and-...


12

When I was examining licenses for some content that I create, I came across the Free Software Foundation's "How to Choose a License for Your Own Work" page. Of course, their first recommendation is the GNU General Public License, a strong copyleft license. However, they do have exceptions to this: For small programs (they define small as <300 lines), ...


11

I think this will be impossible to ever handle automatically: There are many, many questions that make sense without any sample code. I think manually commenting where it is really needed remains the way to go.


9

If line numbering is really so problematic (IMO not), what about debugger-like break points? Not a complete solution, but at least very "visual". <!-- language: lang-java --> <!-- break color:red --> @Override public int add(int num1, int num2) { <!-- break:"here" color:yellow --> return num1 + num2; } And the ...


9

It's unnecessary and rather contradictory to the fact that it's desirable to submit short self contained compilable examples. See www.sscce.org. An editor that facilitates uploading large amounts of code will cause the upload of large amounts of code. We don't want that. The markdown format works well enough. It's also nice to be able to see the question ...


8

Well, your original question referenced specific code that wasn't working as expected. You jumped to the conclusion that it was about using Java vs Mathematica syntax. What makes you so sure that is even the problem? It's unclear from the question how your problem even relates to the question you're asking as an end result. Have you tried using the other one ...


8

Those 2 lines are public domain because they don't meet the threshold of originality. Copying them is not fair use: it's entirely free as far as copyright goes. This is valid in all countries. However it's possible even for a single line of code to be original and hence copyrighted. The distinction is usually hard to make and varies per jurisdiction, which ...


8

Besides that just typo questions should be flagged rather than answered, you can always (almost?) use (language specific) comments to highlight your code changes: Ah, just a typo. You meant: <html><!-- <<<<<<<<< <htwl> is mistyped --> <body> document </body> </html> Not ...


8

I don't think such a feature would be really useful. If you're going to use that snippet in your own code, you need to copy/paste the code into your IDE and your IDE will be able to provide the documentation. If you want to test/analyze code in a question to help solving the author's problem, you'll copy/paste the code into your IDE and your IDE will be ...


7

Short answer: No. If you are unable to fit your problem into the question itself, it probably fails either the "specific" or "practical" test for questions. It also fails the test of "reasonably scoped".


7

Stack Overflow is better suited for practical programming questions about specific issues. Try CodeReview.StackExchange.com for code reviews. Be sure to read their FAQ though. For one, I think it's preferred or even required to put your code (the relevant bits) in the question to make it stand on itself, as well as to prevent link rot. To quote the relevant ...


7

Perhaps we should consider improvements to the posting interface as well: More explicit ways to say "This is code, and thus covered under the code license." Just using code formatting as a determination seems too likely to include content that shouldn't be included, and leave out content that should. A way to (easily) say "this is code, and I'm releasing it ...


7

I am in favor of this, SmartyPants-like formatting is an annoyance. If people want to write typographically correct characters they should use an input method that supports that on their systems. I use the X11 compose key, on Windows there is a nice program called WinCompose and alternatives exist on all platforms. (For example on Android I use ...


7

You can just go to the revisions list (by clicking on the 'edited <timestamp>' link below the post, above the editor's user card), scroll down to the previous revision, and click 'rollback'. That will bring the post back to that state. You've already posted a comment notifying the user of this problem, so they are probably aware and might reply ("sorry, ...


7

You don't. You post your own answer, referencing the other post, and explaining why your answer works better and where. We respect the intent of the poster in edits.


6

You can answer any question you want in any way you want. We don't tell you what to answer and how to answer. Consider, however, that the community has established what makes an acceptable question and will downvote and close (and eventually delete) and question that is not acceptable. Questions that are not acceptable are indeed such questions that simply ...


6

As mentioned in the comments, Stack Exchange uses Google Prettify for its highlighting purposes, so typically bug reports should be directed at the project, and if they're addressed, they'll be pulled into the version used here. Your specific case has actually already been reported, though no action has been taken on it. The Perl lexer is also handled by ...


6

I just found a solution for this. If you put a </ul> after the listed item. The issue will be fixed.


6

You don't. Leave a comment, or leave it to people with 2k+ rep to make the edit. Suggested edits require review, and thus time from several people to review the change. To limit the size of the review queue only suggested edits have a minimal requirement of being non-trivial. High-rep users can make trivial edits at will as they can make the edit directly ...


6

I disagree with this. Stack Overflow is a Q&A site where you can ask and answers programming questions. It is not a compilation tool. If you want to show your code with compilation (e.g. to say code works fine), you can compile your code on particular tool. And add it's link on your post. But remember don't just add link in your post. You should add your ...


6

This was changed to address a long-standing issue with Macs' weird-ass "auto-hiding-and-then-reappearing-on-top-of-your-code" scrollbar feature. More details in Ted's answer here: Has the padding on code blocks been increased?


5

Say you have indented code lo rem ip sum (just much longer) and you want to indent a bunch of consecutive lines. Place a random letter at the start of the first line you want to indent further, lo a rem ip sum select the lines you want to indent, ctrl+K, and delete the random letter.


5

I found a helpful userscript: SO - Code line nums The script toggles line numbers of code boxes when you click on the #L symbol in its top right corner. (It refers to mdev.me, so script blocking has probably to be adjusted)


5

Starting today, this is possible. See: Could authors overturn recent community review decisions?


5

When a question is incomplete and vague (code or not), then you should flag or vote to close the question as Not A Real Question. That is plenty enough, really. The point of closing questions is that a question poster that does not include code is not always going to put in the work to improve the question after the fact either. I rather reopen a question ...


Only top voted, non community-wiki answers of a minimum length are eligible