I posted a question and a couple of respondents asked for the source code. I could only post portions of the code.
If attachments were allowed I could have uploaded a .zip file with the whole application. Will this be a feature in SO?
I posted a question and a couple of respondents asked for the source code. I could only post portions of the code.
If attachments were allowed I could have uploaded a .zip file with the whole application. Will this be a feature in SO?
I'm strongly against such a feature. StackOverflow is meant to be a knowledge exchange platform, where we try to build, say, the Wikipedia of programming questions, not a place for troubleshooting "hey, dig through my source code. fix the problem for me" issues for free.
Currently, if you look at the answers in Stack Overflow, many of them are much longer than "change that line to something else" type of answer. Many good answers here really try to explain the reason that caused the problem and many alternative suggestions. They are more like blog entries than classic answers found in forums. This is what makes Stack Overflow a unique Web site. Those answers can be useful for a lot of people, not just the OP.
As a consequence, I believe any feature that encourages asking arbitrarily long questions and make the OPs think less before asking is completely against the spirit of Stack Overflow. It would no longer be a knowledge exchange platform but place to troubleshoot specific problems, which in my opinion, is no fun at all.
There are lots of free file hosts you can use -- it puts us in a difficult position to be hosting arbitrary files for user.
SO allows a substantial amount of code to be posted. In all honesty, if you're finding the limit to be too little, you're probably not getting close enough to your problem before posting your question.
Many people, not accusing you, ask questions like "What's wrong with this?" and then plaster 100 lines of code into their browser (many times un-tabbed). Try not to be that person. Instead, use your error-reporting to determine what problematic section should be copied. That, or ask a more general question about your issue and extract a solution from the answers.
I think if you're posting a zip file of code for a question you're posting far too much.
Questions should be limited to specific problems or functions in your application so that the error can be readily seen and fixed by other members. I know I definitely wouldn't go digging through multiple files of code to try and solve an issue, but that's just me.
When questions exhibit more than a dozen lines of code, I switch to another one. Digging the code for finding bugs is my real life job, and I am good at it because I have spent time for learning the context. Getting into that kind of learning curve is not something I expect from Stackoverflow.
As a potential answerer, I expect from Stackoverflow that the OP has already isolated his bug and is able to present its essence to the community.
As a potential asker, I expect from Stackoverflow that the essence of the problem I am struggling against has already been exposed and solved. This will never be the case if every problem is flooded with specific context.
I'm actually a bit surprised by the amount of negative emotions towards this in general... As Mehrdad pointed out, Stack Overflow is a great knowledge exchange platform. I completely agree. It is an excellent knowledge exchange platform. But why must we limit knowledge transfer to text?
The ability to upload supporting docs/code/images/etcetera to questions and answers is definitely a limitation of the overall SO experience. As Jonathan pointed out, questions that are along the lines of "hey whats wrong with these 200 lines of code" are going to be frowned upon. These questions will be met by down-votes and folks asking what the specific issue is. If someone were to post a project in a zip file and say "whats wrong with my project, it doesn't work"), it'll be met by huge resentment with downvotes, negative comments, etc.
So what do we lose by folks posting some zip files with project code in them? Do we stand to be negatively affected more by that or will our overall experience be improved? I certainly don't think it would be more negative and having this feature would only help some folks and make answers a bit more robust.
I'd like to approach this from another angle.
I spend a lot of time on the Electronics Stackexchange site, and many questions and/or answers there have links to component datasheets on external sites.
Now, I thought that the general policy was that questions and answers shouldn't rely on external sites if at all possible, so that if the external site went down / went through a restructuring, the question or answer was still complete and valid - hence the enforced use of imgur to host images.
Now, being able to attach the datasheet to the answer instead of referring to an external site must surely be a bonus to the longevity of the content in general.
I agree that uploading whole projects, or big code files is a no-no as this doesn't add any value to the content, but being able to attach files with information in to which the answer refers instead of relying on the data still being on an external site 6 months down the line has to be a big yes point.
Maybe it should only be allowed for answers, and not questions, and maybe for people with more than a certain threshold of reputation.
I understant there are 10's of good reasons against uploading code files, however: what if it's the answers that require some uploads?
I had the perfect code for a utility function that did exactelly what the OP was asking for. Code was 200+ lines, and would probably benefited a lot of people trying strugling with the same formatting problems.
Then you could just answer:
Well, this is the function that I use to format a DataSet into an XML-compliant Office Excel 2007 document: codegoeshere.cs
I would love to be able to upload small 10-15kb human-readable text files.
Here's a (naive and dumb) SEDE query counting instances of the domain of the first URL used in any post containing a URL within a Stack Exchange, and having instance counts >= 10.
SELECT
SUBSTRING(
P.Body COLLATE Latin1_General_BIN,
CHARINDEX('<a href=', P.Body COLLATE Latin1_General_BIN)+9,
CHARINDEX(
'/',
P.Body COLLATE Latin1_General_BIN,
CHARINDEX('<a href=', P.Body COLLATE Latin1_General_BIN)+9+8
)-(CHARINDEX('<a href=', P.Body COLLATE Latin1_General_BIN)+9)
) AS Url,
COUNT(*) AS [Count]
FROM Posts P
WHERE
CHARINDEX('<a href=', P.Body COLLATE Latin1_General_BIN) <> 0
GROUP BY SUBSTRING(
P.Body COLLATE Latin1_General_BIN,
CHARINDEX('<a href=', P.Body COLLATE Latin1_General_BIN)+9,
CHARINDEX(
'/',
P.Body COLLATE Latin1_General_BIN,
CHARINDEX('<a href=', P.Body COLLATE Latin1_General_BIN)+9+8
)-(CHARINDEX('<a href=', P.Body COLLATE Latin1_General_BIN)+9)
)
HAVING COUNT(*) >= 10
ORDER BY [Count] DESC
Blender (run query):
See also their highly voted Allow permanent blend file hosting
Ask Ubuntu (run query):
This site is intended for use as a short-term exchange of pasted information between parties. All submitted data is considered public information. Submitted data is not guaranteed to be permanent, and may be removed at any time.
At this moment in time we do not delete pastes that do not have an expiration date. But in the future we might automatically delete pastes that have not been viewed by anyone in more than 6 months. Again, this is not something we are doing at this moment. But we might start doing it in the future.
You can run it on other sites using the site selection menu.
I mean- this is a lot of off-site content. I just gives me some whiplash in the brain that we're so insistent on making sure we protect against link rot, and yet all the above is fine enough to ignore? And what about the nightmare scenarios? We're just fine with what happened with pasteall.org?
Don't get me wrong. I'm not saying that every site really needs this. And if it were to be implemented, I'd be very concerned about it being used when it doesn't need to be, or as a crutch for not putting in the effort to make a minimal reproducible example on Stack Overflow. And probably security needs significant consideration and corresponding protection mechanisms too.
I'm just trying to look at what's happening on the ground, and wonder if it's fine with us. Particularly, Blender seems to have a real use-case and need. And I say this as someone looking in at them from the outside.
It is not likely that StackOverflow will implement file uploads into their service. They are trying to discourage people posting files with hundreds or thousands of lines of coding and expecting someone to spend all their time looking for the problem. Instead, S.O. wants people to only post the snippet of code which has problems so that people can easily detect the problem without breaking a sweat and to save server storage space.
However, you do have a good point for programming languages that do not exist in the form of plain text or have to interact with other elements to function, such as the old version of GameMaker (version 8.0 and below, not GameMaker: Studio). If you don't want to hear me brag about GameMaker: Studio, skip the next paragraph.
GameMaker: Studio appears to have a few removed object actions from my experience. Some actions were unknown when I opened up an object in a project file. I find it a bit slower and harder to use than V8.0.
Unlike GameMaker Studio, where you can paste the code for certain parts of a project, GameMaker files cannot be simply viewed as readable plain text and normally problems are hidden in different parts of the file than what you think.
If you want to give people access to the files that have problems, which you should only do when you really need to, consider file sharing services like DropBox or Google Drive. While Google Drive gives you 15GB of free storage while Dropbox only gives you 2GB free, Dropbox does not care about executable files where as Google Drive will try to stop you in case of it being a virus.
Don't ask people to download the program you used to create the project file. I learned that the hard way.
If you’re knowledgeable with HTML + JavaScript, you can add a code snippet that will download a file to your computer.
I've read a couple of the responses falling on the side of the argument that uploading code might be a bad thing.
Configuring and building projects can be a difficult task, especially for beginners - and sharing a Visual Studio solution may be the only way readers can determine the cause of the problem.
In short, I think uploading would be a great feature.
Youtube can store and serve all that video, so what's a few source code files by comparison?! Isn't that what the Internet's all about?
I take onboard that there are free hosting sites that specialize in hosting files, but providing a git / SVN compatible interface to SO to allow users to upload files or projects would greatly add to the quality of Stack Overflow. IMHO.
For small binary files, you can insert a code block containing the file’s base64-encoded contents directly within a post, using the uuencode -m
command. It looks like this:
begin-base64 644 test.txt
VGhpcyBpcyBhbiBleGFtcGxlIGJpbmFyeSBmaWxlIQo=
====
The maximum length of an answer is 50 thousand characters; the overhead of base64 encoding alone makes that 37.5 kB of binary data. If you subtract the size of any surrounding text, this should suffice for files up to about 20 kB in size, although using compression you might be able to squeeze a bit more out of that. Ah, just like in the good ol’ days of alt.binaries.er
… er, .slack
. Yes, alt.binaries.slack
.
I’ve even got a proof-of-concept user script that adds a download button to code blocks formatted in this way. Adding upload functionality should not be too hard, though so far I have not had much need for it myself; command line is sufficient for me now.
No one wants to dig through an entire project to find the problem but sometimes when i post a question i think the problem lies in one part of my code but it really is something else entirely. It would be nice to be able to say here's the relevant code but here is the full file just in case my problem is in a different part. If we narrow the scope to including one file not an entire project i think is a perfectly acceptable thing to do. it should not necessarily be hosted on stack overflow but i think posting a link to the file instead of dumping it all into the question is a much better approach.