Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [code]

For questions or problems relating to the use of code in questions or answers on a site or the way that markdown works with code/preformatted text.

2
votes
1answer
36 views

“Improperly formatted code” when adding an additional image in an edit

I made a question on Stack Overflow and then tried to edit it so that what I entered in the entry box was the exact text shown below in the code block. The system would not let me post it, throwing ...
3
votes
0answers
21 views

Incomplete rendering of code blocks in Android app [duplicate]

I'm running the Stack Exchange app v1.0.95 on a Samsung Galaxy S7 Edge running Android v7.0. Over the last few days, I'm noticing that the app doesn't fully render code blocks anymore. It renders ...
2
votes
0answers
109 views

Bug: \u200b and \u200c characters added to code snippet in comment [duplicate]

See this comment in the Stack Exchange sandbox. I quote it here: Have a look at this JS code: document.body.removeChild(document.body.appendChild(document.createElement('style'))); If you manually ...
-4
votes
1answer
58 views

Add a way to highlight/emphasize changes in code [duplicate]

Answers to coding questions often use a minor change to the example code. But because it's code, you cant emphasize those differences with markdown syntax. See example below where I've done some ...
-5
votes
1answer
53 views

How to add code in the editor [duplicate]

I want to know how to add code tags in this editor. As an example if I want to post an answer in PHP, as soon as I type "open php" my line disappears. How to post PHP with open and close?
8
votes
0answers
63 views

Code snippet comments in code formatting break the formatting of the post

When special HTML comments used for snippets are present in a post, these comments break the rendering of the post. For example, consider the following markdown code (notice that the whole thing is ...
2
votes
1answer
253 views

No vertical scroll bar for the code snippets on Google Chrome on iPad

There seems to be no vertical scroll bar for the code snippets on Google Chrome on iPad, e.g.: Unit test best-practices in Python:
5
votes
1answer
54 views

Question in English but code in a foreign language. Is this according to policy? [duplicate]

Recently, I came across this, which is a English question but the code is obviously not. I've searched around and found the official policy on foreign languages and wondered if this applies? To be ...
2
votes
0answers
17 views

Inconsistent code highlighting on the iOS app

I've noticed a few posts with code blocks that aren't getting any syntax highlighting when they should. This Q&A for example has no highlighting: Whereas this Q&A does: The strange ...
0
votes
0answers
72 views

Can this be added to Stack Overflow? [duplicate]

First off, I would like to apologize if I am posting this in the incorrect location, as I am not sure where else to put this. I use Stack Overflow all the time, and I have always wondered if a "...
2
votes
0answers
42 views

False Positive: Your post appears to contain code that is not properly formatted as code [duplicate]

I don't know why I'm getting the dreaded "Your post appears to contain code that is not properly formatted as code" error on this post. Here is the text of my post as I originally wanted to post it: ...
-15
votes
1answer
80 views

Why not have some site that is about help debugging one's code?

I am aware that Stack Exchange is intended as a repository; it is not a place for people to post buggy code, or even no code at all, and seek help. But I notice that there are helpful people who ...
-5
votes
3answers
99 views

Please add a full-frame text editor to StackOverflow [duplicate]

edit #2: here's what the editor looks like in SBS mode when using SOX Done and done. Thanks @ᔕᖺᘎᕊ edit: My point here is that when editing code there is a lot of unused screen real-estate. I don't ...
6
votes
0answers
1k views

Code block markdown formatting using <pre>

The official Markdown syntax reference page says (emphasis added): The only restrictions are that block-level HTML elements — e.g. <div>, <table>, <pre>, <p>, etc. — must be ...
2
votes
0answers
24 views

Backticks within backticks work differently in posts and in comments [duplicate]

Writing backticks within backticks works differently in posts and in comments. For example: Use `` `backticks` `` instead of bold text for code-like terms. In posts, this is rendered as the text "...
7
votes
0answers
52 views

Disable Smarty-like formatting in titles

I tried editing a recent Stack Overflow post with an em-dash in the title. When I tried to fix it, I discovered the post actually contained two hyphen-minus (-) characters in the first place – and ...
5
votes
2answers
67 views

Will we be able to reference code from before the license change in new posts?

When we change the license on our codes from CC BY-SA 3.0 to the MIT license, will we be able to copy and reference code from old posts in new posts, or will we only be allowed to provide links to old ...
7
votes
1answer
300 views

Why should the new code license be permissive instead of copyleft?

Currently (and, I assume, since SO’s/SE’s existence) all user-generated content is licensed under a copyleft license. In the discussions The MIT License – Clarity on Using Code on Stack Overflow and ...
13
votes
1answer
98 views

Add an indicator for the license to code blocks and a tool to copy code with the proper attribution

I think it is a fair assumption that a large number of people using Stack Overflow and other programming SE sites don't understand or don't even think about the implications of the license when using ...
5
votes
2answers
167 views

Unable to copy unprintable unicode characters into the code editor

I recently asked a question about how an obfuscated program that relied on non-printable unicode characters worked. One of the problems I had here is that when I tried copying the code into my ...
12
votes
4answers
3k views

Is copy-pasting code from Stack Overflow an infringement to CC BY-SA 3.0 or is it considered fair use?

Actually CC BY-SA 3.0 is a license which looks pretty good for most Stack Exchange Network sites, but on Stack Overflow which is used mainly for coding questions, is pretty much rigid since a lot of ...
1
vote
1answer
46 views

How should I present a common Minimal Working Example for multiple questions?

I have several questions for the same piece of code. Should I present the Minimal Working Example in a question and provide a link to it from the other questions, or it is better to copy the MWE to ...
5
votes
1answer
87 views

Distinguish languages when displaying stack snippets

I just integrated my first snippet on an existing post, nice work. I put it on this post: https://stackoverflow.com/a/19932511/731138 Code appears without language distinction, with a small space as ...
0
votes
1answer
54 views

A code sample inside of an italicized block should not be italicized

I wrote the following comment on a post on Meta.SO: Not the language-lawyer tag again... The comment shows up as italicized (which it should), but the code inside of the italicized comment should ...
1
vote
1answer
116 views

Is it correct to post whole of the code in question?

How I Came Up with this Question? Is it a good way to post the whole code, the whole project in a question? I see new users or even many old ones posting the whole code and ask to point out where the ...
5
votes
1answer
120 views

How to edit answers to fix syntax errors when “Edits must be at least 6 characters” [duplicate]

While looking for an answer of my problem "How to round numbers with decimals in javascript", I found this SO answer https://stackoverflow.com/a/14194399/177665 This can be done using Javascript as ...
-12
votes
1answer
75 views

Suggestion for Code Insertion [closed]

The Insertion of codes can be made more easy to use. As a new user, it becomes confusing to use at times
2
votes
0answers
63 views

Answering with just code [duplicate]

Is it bad practice to answer with just code and no explanation? I had someone complain about this once but everyone seems to do it.
2
votes
1answer
67 views

Would it be possible for SE to share the code they used to enable imgur uploading via PageDown?

I've been working with pagedown and am trying to customize the image modal that comes from Markdown.Editor.js to enable direct-to-imgur uploads. I can handle that fine on a page of my own but I'm at ...
12
votes
0answers
208 views

Is there a way to know how many total lines of code Stack Overflow has produced?

Recently I saw an infographic called Million Lines of Code and I think it would be really cool if Stack Overflow could be on it. I am sure there are thousand upon thousand lines of code the Stack ...
2
votes
1answer
114 views

What's acceptable practice for Stack Overflow code review for several source files, GitHub?

I have some code that I want to put on Stack Overflow for a code review. What is the best way to handle multiple files? Should I just ask a question and put a link to a public GitHub repository? ...
-4
votes
1answer
92 views

Code comparison when asking

What if <Code Sample>s and formatted code will compare with existing questions' <Code Sample>s and formatted code and let the user (who asks) to know if there are similar question? For ...
1
vote
0answers
28 views

A bug with tags/code parser [duplicate]

I wanted to add a list and some code: link the list sometimes becomes bold on editing, but I wrote it correctly. I don't know what to do with code at all because its parser doesn't work properly
-8
votes
1answer
685 views

Run/Test code in Stack Overflow [duplicate]

Is there any feature in development for Stack Overflow to RUN/TEST code online? I see many questions are linked to some other online tools to run and test the submitted code/corrected code. Like the ...
-6
votes
2answers
129 views

Are we requiring code too often?

Earlier today I posted a question which, I feel, doesn't require code. It's a general knowledge sort of question, rather than one specific to faulty code. Granted, the question came about because I ...
4
votes
2answers
288 views

Should error logs be formatted as code or quote?

When I see an unformatted error log, I format it as code I've noticed, however, that some other users format them as quotes Which is better? tessdata_manager.SeekToStart(TESSDATA_INTTEMP):...
0
votes
2answers
73 views

Is it appropriate to remove excessive commenting from code?

I am referring to this question on SO https://stackoverflow.com/revisions/17182684/1, where there is a massive amount of commenting within the code (the question has since been edited to correct this)....
-1
votes
1answer
82 views

Please, make the contents of the page occupy the whole page width, or at least make the code windows resizable [duplicate]

Please, make the contents of the page occupy the whole page width, or at least make the code windows resizeable.
1
vote
0answers
131 views

Are code-only answers a good thing? [duplicate]

I just stumbled across this question. While the question itself is not perfect, both the answers to date have just been blocks of code. When I reply to a question, I usually (admittedly, not always) ...
3
votes
1answer
149 views

How to fix a single character typo in a code sample? [duplicate]

I just wanted to fix a code sample which had a single character missing. However I can't do this because the minimum edit is 6 characters. Can we make the checker smarter by allowing single character ...
-1
votes
2answers
177 views

Auto-comment questions with lack of code

There is many questions on the StackOverflow from a new members where it is impossible to answer until OP will show some code and specify failing line. Currently we are writing the same comments under ...
-28
votes
2answers
321 views

Allow only pseudo-code in answers? [duplicate]

On Stack Overflow, I see a lot of people answering questions with just code. It is not helpful to anyone at all. So, would it be possible to enforce pseudo-code answers? In my opinion, pseudo-code is ...
8
votes
2answers
99 views

Is it better to fix the OP's code or provide a better approach?

In a lot of questions one can see that the OP's code works almost correctly, but his/her approach is not the best one. For example: remove specific line returns ("\n") from file Where ...
1
vote
3answers
108 views

What to do when the OP feels they asked a wrong question?

Suppose someone asks a question on Stack Overflow, and after posting and working on the problem some more that person realizes there actually was not a problem at all but it was only their ...
3
votes
2answers
87 views

Add 4 spaces in the middle of the code

I know that if I press ctrl + k I automatically can add 4 spaces, but what if the code has already 4 spaces and I need to add 4 spaces more to it? If I press tab in the SO editor it just gets me ...
3
votes
3answers
140 views

Am I allowed to post an entire project instead of portions of code in Stack Overflow?

There is a project (Objective-C, made with xcode) that I messed up, there are runtime errors to correct. But the project is so big, the code is huge. Am I allowed to attach a zip file containing the ...
2
votes
1answer
1k views

Format code block quickly? [duplicate]

Possible Duplicate: How do I format my code blocks? What is a quick way to format many lines of code for Stack Overflow? I insert all 4xNLines spaces each time one by one, and wondering that ...
1
vote
0answers
35 views

Are “live collaborative” online pastebins/compilers acceptable for use in a question? [duplicate]

Possible Duplicate: How should we deal with questions that have broken links? Refer to this question (visible only to 10K users): "why does finding max height of a tree behave differently on ...
1
vote
2answers
173 views

Should I encourage questions asking for a tutorial link or code snippet?

I have seen many questions on SO which ask for a tutorial on some specific topic or some functionality. Some users say "this is not a good place to ask for a tutorial" or "hit Google". But maybe some ...
10
votes
1answer
172 views

Encourage Questions to Include Code Samples

I know this has been noted before, but it's amazing how often people ask questions about code that's not working without sharing the code. And when they share code, it's often insufficient (which ...