内存溢出和堆栈溢出

Stack Overflow is an incredible collection of programming and software knowledge. Thousands of students and developers use it daily to lookup answers for questions they can’t solve easily themselves. Stack Overflow taught me so much over the years, I have used it since I began to learn to program. It’s built and grown by a community of developers, with new questions and answers being added all the time.

堆栈溢出是令人难以置信的编程和软件知识的集合。 每天有成千上万的学生和开发人员使用它来查找自己无法轻松解决的问题的答案。 多年来,Stack Overflow教会了我很多东西,自从我开始学习编程以来,我就一直使用它。 它由开发人员社区构建和发展,并始终添加新的问题和答案。

However, contributing to Stack Overflow, asking questions and answering them, is vastly different from just searching and reading information on the site. Stack Overflow has a very steep learning curve, for a long time, it wasn’t really welcoming toward beginners. If you are interested in using it to grow and further your skills or reputation as a developer, this article is for you. On a site like Stack Overflow, there is no right or wrong, all content will eventually be moderated by the community. Yet, you will want to avoid situations where despite good intentions, you get downvoted to oblivion.

但是, 促成堆栈溢出,提出问题和回答问题与仅在站点上搜索和读取信息有很大不同。 长期以来,Stack Overflow的学习曲线非常陡峭,对初学者并不那么受欢迎。 如果您有兴趣使用它来发展自己,并提高自己作为开发人员的技能或声誉,那么本文适合您。 在Stack Overflow之类的网站上,没有对与错,所有内容最终都将由社区管理。 但是,您将希望避免尽管有良好的意愿但又被遗忘的情况。

目的 (The Purpose)

When people start using Stack Overflow, they often don’t fully understand the purpose of the site. Stack Overflow is not a discussion site or a forum. It’s a knowledge base. That means for whatever questions are asked, any answer should be accurate, specific, and useful to the highest degree. It’s not a place to post partial answers or to ask questions on questions. Answers are upvoted and downvoted to determine the communities opinion on them. There’s one, critically, crucially important detail to understand about upvotes and downvotes: Roughly 80% of all votes on Stack Overflow are downvotes.

当人们开始使用Stack Overflow时,他们通常并不完全了解该站点的用途。 堆栈溢出不是讨论站点或论坛。 这是一个知识库。 这意味着,无论提出什么问题,任何答案都应准确,具体且在最大程度上有用。 这不是发布部分答案或提出问题的地方。 回答是否正确,可以确定社区对此的看法。 有一个非常关键,非常重要的细节需要了解有关投票和降票的信息:关于Stack Overflow的所有选票中大约有80%是投票。

In fact, there’s even some users with hundreds of thousands in points that have an up to down vote ratio of over one to one thousand. That means for every one up vote they gave, they also gave over a thousand down votes. This isn’t meant to scare you, it’s to help you understand Stack Overflow does have a high standard of quality for content. Even the best answers also get their share of down votes. Any answer you give should have careful thought and effort put into it.

实际上,甚至有些用户拥有数十万的点数,其最高投票率超过一千。 这意味着他们每投票一票,他们也会投票一千票。 这并不是要吓you您,而是要帮助您了解Stack Overflow确实具有高标准的内容质量。 即使是最佳答案,也将得到他们的反对。 您给出的任何答案都应该经过认真的思考和努力。

Being a knowledge oriented site can also imply there’s no room for subjectivity. To an extent that’s true, but it’s more complicated than that. Whether or not something is considered subjective depends on how much information exists on that particular problem, or if there is a widely accepted solution. For example, a question asking “How to add more items to a list in Python?” could only be reasonably answered by suggesting to use the append or insert methods of a Python list. An answer giving a solution by construction an entirely new list, would likely be heavily downvoted. That’s because a list in Python is designed for mutability, answers diverting from that use will simply not be useful or welcomed.

作为一个面向知识的网站,也可能意味着没有主观性。 在一定程度上是对的,但要复杂得多。 是否认为某件事是主观的,取决于有关该特定问题的信息量或是否存在被广泛接受的解决方案。 例如,一个问题询问“如何在Python中将更多项目添加到列表中?” 只能通过建议使用Python列表的append或insert方法来合理地回答。 通过构造一个全新的清单来给出解决方案的答案可能会被严重否决。 这是因为Python中的列表是为可变性而设计的,从该用法中转移出来的答案将根本无用或不受欢迎。

Asking “How to ensure a particular module is only imported from a certain directory?” is a question that’s more open to interpretation and does not have a widely accepted methodology. A simple answer to such a question would be to suggest inserting the directory path at the beginning of sys.path . Although that answer works, it’s still not full proof. The Python interpreter actually checks sys.modules before it checks sys.path . There’s also a completely different way to achieve the same desired behavior, to run Python in a virtual environment, avoiding conflicts between module names altogether. The point is, there’s multiple ways to answer such a question, given any answer accurately argues for itself.

“如何确保特定模块仅从特定目录导入?” 这个问题更易于解释,没有广泛接受的方法论。 一个简单的答案就是建议在sys.path的开头插入目录路径。 尽管该答案有效,但仍不是完整的证据。 Python解释器实际上检查sys.path 之前先检查sys.modules 。 还有一种完全不同的方式来实现相同的期望行为,以便在虚拟环境中运行Python,从而完全避免模块名称之间的冲突。 关键是,给定任何答案都可以正确辩解的情况,有多种方法可以回答这样的问题。

Next, look at both the best, and worst ways you can use Stack Overflow to grow and improve as a developer.

接下来,研究使用Stack Overflow作为开发人员来成长和改进的最佳和最差方法。

最差 (Worst)

As mentioned previously, there’s no wrong way to use Stack Overflow. Yet, there are many pitfalls and traps you can avoid to prevent being heavily downvoted. These are those patterns of contribution you will want to avoid.

如前所述,使用堆栈溢出没有错误的方法。 但是,您可以避免很多陷阱和陷阱,以防止被严重否决。 这些就是您希望避免的贡献模式。

问简单的问题 (Asking simple questions)

Most simple questions are likely to be closed as duplicates on Stack Overflow. This happens to questions that are usually have a solution found easily in a language’s or package’s documentation. While this won’t subtract points from your total score on the site, it’s just a waste of time since you won’t get your question upvoted. Both questions and answers can be voted on, up votes in either case increase points, while down votes decrease them. Try to search if you question exists before you ask it.

大多数简单问题很可能会作为Stack Overflow上的重复项关闭。 这通常发生在通常在语言或软件包的文档中很容易找到解决方案的问题上。 尽管这不会从您在网站上的总得分中减去分数,但这只是浪费时间,因为您不会提出自己的问题。 可以对问题和答案都进行投票,无论哪种情况,都可以提高投票数,而减少投票则可以降低分数。 询问之前,先尝试搜索是否存在问题。

Keep in mind, sometimes questions are mistakenly marked as duplicates. This can be because you weren’t clear enough on the specific answer or knowledge you sought. Good news, Stack Overflow allows you to edit a question and reopen it if this happens, netting you more points if that edit is better received.

请记住,有时问题被错误地标记为重复。 这可能是因为您对所寻求的具体答案或知识不够清楚。 好消息,Stack Overflow允许您编辑问题并在出现这种情况时将其重新打开,如果更好地接受了此编辑,则可以为您赢得更多的分数。

提供与问题不符的答案 (Giving answers that don’t match the question)

This might sound obvious, whatever answer you contribute should be suited for the question being asked. Stack Overflow enforces a rather strict interpretation of this rule, though. Submitting an answer which suggests a solution that either doesn’t fully resolve the problem, or uses a different tool or method than what’s specified, is highly frowned upon, and will result in downvoting. This is probably the absolute worst way to use Stack Overflow.

这听起来似乎很明显,无论您提供什么答案都应该适合所提出的问题。 但是,堆栈溢出强制对此规则进行了相当严格的解释。 提交的答案表明解决方案不能完全解决问题,或者使用的工具或方法与指定的方法不同,因此对此表示强烈的反对,这将导致投票失败。 这可能是使用堆栈溢出的绝对最糟糕的方法。

An example can be as follows. There is a question, “How to get the stderr from a process with Popen?”. You answer, “This can be accomplished using subprocess.run and accessing the stderr attribute of the return value”. This answer would be considered inappropriate for the question, because it’s specifying the use of a different builtin object the question is not asking about. Stack Overflow is not a discussion forum, and such answers are not useful or desirable on that particular question.

一个例子可以如下。 有一个问题, “如何从使用Popen的进程中获取stderr?”。 您将回答: “这可以使用subprocess.run并访问返回值的stderr属性来完成”。 该答案将被认为不适合该问题,因为它指定使用该问题未询问的其他内置对象。 堆栈溢出不是讨论论坛,并且这样的回答对于该特定问题没有用或不希望有。

用热门标签回答问题 (Answering questions with highly popular tags)

Questions on Stack Overflow are organized by tags relating to the specific topic of software development they are concerned with. The site holds tens of thousands of tags, encompassing every topic you can think of. The most popular of which are general programming language tags, such as [javascript] or [python] . The most popular tags have hundreds of thousands, if not millions of questions listed under them. While you may see a lot of questions that feel easy to answer, there are some substantial risks.

关于堆栈溢出的问题按与他们所关注的软件开发特定主题相关的标签来组织。 该网站拥有成千上万个标签,涵盖了您可以想到的每个主题。 其中最受欢迎的是通用编程语言标签,例如[javascript][python] 。 最受欢迎的标签下有成千上万个问题,即使不是数百万个问题。 尽管您可能会觉得很多问题很容易回答,但存在一些重大风险。

Remember the user I mentioned that gives over a thousand downvotes per one up vote? Users similar to that are likely top contributors and lurking in popular tags. Answers you give to questions under these tags will be under high scrutiny. Additionally, many questions in such tags get answered very quickly, as many people are also looking at them. By the time you write a well thought out answer, some top contributor may have already answered it before you. Or, your answer or code may miss small details involved in answering the question, leading to a higher degree of downvotes. Generic, language syntax type of questions are frequently marked as duplicates, so you may start putting effort toward an answer for nothing.

还记得我提到过的用户,每一次投票就有一千多票的赞成票吗? 与此类似的用户可能是最主要的贡献者,并且潜藏在流行标签中。 您对这些标签下的问题的回答将受到严格审查。 另外,此类标签中的许多问题很快就会得到回答,因为很多人也在看它们。 当您编写一个经过深思熟虑的答案时,某些杰出贡献者可能已经在您面前回答了。 或者,您的答案或代码可能会错过回答问题所涉及的小细节,从而导致更高的否决率。 通用的语言语法类型的问题经常被标记为重复项,因此您可能会开始全力以赴地寻求答案。

最好 (Best)

These strategies and tips are meant to help you achieve the most up votes with the least down votes.

这些策略和技巧旨在帮助您获得最多的赞成票而最少的反对票。

用不太受欢迎的标签回答问题 (Answering questions in less popular tags)

In less popular tags, such as [csv] or [bson] , questions stay unanswered for much longer periods of time. Such tags also have far less super contributors (reputation > 100k) you have to compete with. There’s also less intensive, harsh moderation going on. I am by no means suggesting that moderation is bad or counterproductive. On the contrary, it’s what builds Stack Overflow as a community. However, not all moderation is conducive to increases in quality.

在不太受欢迎的标签(例如[csv][bson] ,问题会在更长的时间内保持未回答状态。 这样的标签所具有的超级贡献者(声誉> 100k)也要少得多。 另外,强度较低,苛刻的调节正在进行中。 我绝不暗示节制是有害的或适得其反。 相反,这是将Stack Overflow建立为社区的原因。 但是,并非所有节制措施都有助于提高质量。

I wrote this answer to a question I had asked which to my surprise, no one answered. I explained the solution and all the needed steps for others to implement it if they found themselves in a similar situation. Yet, my answer was still downvoted, due to using a different, yet equivalent keyword argument in the setup function for a Python package. There’s no difference in behavior between the two argument fields, but was still marked down by the community. If I were to write that question again, I wouldn’t include the [python] tag.

我写了这个答案 , 回答了一个我很惊讶的问题,没有人回答。 如果他人发现自己处于类似情况,我将解释该解决方案以及所有其他实施该解决方案所需的步骤。 但是,由于在Python程序包的设置函数中使用了一个不同但等效的关键字参数,我的回答仍然不理想。 这两个参数字段之间的行为没有差异,但仍被社区标记。 如果我要再次写下该问题,则不会包含[python]标记。

提出没有明显解决方案的问题 (Asking questions with no obvious solution)

The best questions to ask, and the ones that will get the most upvotes, are the ones with no obvious solution. This doesn’t mean super complex questions almost no one can answer or solve. Questions that concern a common situation, but that have no easily identifiable or straight forward solution, are the ones you need to be asking.

最好的问题是那些没有明显解决方案的问题,它们将获得最多的投票。 这并不意味着几乎没有人能够回答或解决的超级复杂问题。 您需要提出的问题涉及一个常见情况,但没有容易识别或直接解决的问题。

I have question that I asked five years ago that has since gotten over 50,000 views. The question asks how to match a particular string against many different possible strings using regular expressions. Generally, checking if a string is present in a group of strings can be accomplished with a hash set. But in the case of regex, there is no widely used method. One option, which turned out as the best answer, is using a list of words joined with the| “or” operator in regex. Another option, the second answer listed, is using named lists from a common third party library for regular expressions. Both answers work fine, but the former doesn’t depend on any other packages, it uses native Python.

我有一个问题 ,我五年前问过,自那以后获得了50,000多次浏览。 该问题询问如何使用正则表达式将特定字符串与许多不同的可能字符串进行匹配。 通常,可以使用哈希集完成检查字符串组中是否存在字符串。 但是对于正则表达式,没有广泛使用的方法。 事实证明,这是最好的选择,其中一个选项是使用带有|的单词列表。 正则表达式中的“或”运算符。 另一个选择是列出的第二个答案,它使用来自公共第三方库的命名列表进行正则表达式。 两个答案都可以正常工作,但是前者不依赖于其他任何软件包,它使用本机Python。

The lesson here is asking questions with no direct or straight forward answers are more likely to be upvoted, and more likely to generate answers.

此处的课程是询问没有直接或直接答案的问题,更可能被否决,并且更有可能产生答案。

结论 (Conclusion)

Overall, Stack Overflow is an immense body of knowledge that’s built by a vast community of developers. Using it is easy, contributing to it isn’t that easy. However, if you put careful thought into your answers, stick to less popular tags, and try to ask more complex questions, you will gain a lot more out the experience.

总体而言,堆栈溢出是由大量开发人员构建的大量知识。 使用它很容易,贡献它并不是那么容易。 但是,如果您对答案进行仔细的思考,坚持使用不太受欢迎的标签,并尝试提出更复杂的问题,您将获得更多的体验。

翻译自: https://medium.com/swlh/the-best-and-worst-ways-to-use-stack-overflow-711a077f2892

内存溢出和堆栈溢出


http://www.taodudu.cc/news/show-5203932.html

相关文章:

  • linux堆栈溢出
  • 堆栈溢出的原因
  • 堆栈溢出一般是由什么原因导致的 堆栈溢出怎么解决
  • python对es数据库使用bulk批量更新文档某字段的值
  • batchupdate写法_mybatis批量update操作的写法,及批量update报错的问题解决方法
  • django 批量创建bulk_create和批量更新bulk_update
  • mongo执行Bulk Update
  • JPA 2.1: Bulk Update and Delete
  • bulk es 删除_elasticsearch里面bulk的用法
  • 用bulkUpdate执行删除批量的数据是出错!
  • django bulk_update_or_create 批量创建更新
  • bulk es 删除_分布式ES:批量操作 bulk 之 create、index、update、delete(十八)
  • SSH批量更新getHibernateTemplate().bulkUpdate(hql)
  • mysql bulk update_Bulk Upsert for MySQL PostgreSQL
  • getHibernateTemplate().bulkUpdate()
  • mysql bulk update_使用SqlBulkCopy批量插入/更新数据
  • ES 5.x bulk update重复的文档ID性能低下分析
  • mysql bulk update_Django bulk_create()、update()与数据库事务的效率对比分析
  • mysql bulk update_91.一次性处理多条数据的方法:bulk_create,update,delete
  • ElasticSearch提供的bulk update性能对比
  • ES 5.x Bulk update重复的文档id性能低下
  • es bulk update 时间格式
  • UE4 websocket蓝图网络连接插件
  • 常用通信、电源接口等接插件封装总结
  • 接插件基本描述
  • IDEA测试工具插件
  • # IDEA插件推荐-快速查找接口`RestfulToolkitX`
  • 适用app inventor的tcp连接插件
  • 爱了,这个IDEA插件一秒定位接口,无缝对接项目,还可以接口测试
  • 程序员对接口与插件深入形象理解

内存溢出和堆栈溢出_使用堆栈溢出的最佳和最差方法相关推荐

  1. 数据结构堆栈 内存堆栈_了解堆栈数据结构

    数据结构堆栈 内存堆栈 In this article, we'll be understanding the working and the need for the Stack Data Stru ...

  2. linux进程的堆栈空间_代码段(指令,只读)、数据段(静态变量,全局变量)、堆栈段(局部变量)、栈【转】...

    转自:http://blog.csdn.net/gongweijiao/article/details/8207333 原文参见:http://blog.163.com/xychenbaihu@yea ...

  3. java数据段 静态区_linux进程的堆栈空间_代码段(指令,只读)、数据段(静态变量,全局变量)、堆栈段(局部变量)、栈【转】...

    一)概述 .堆栈是一个用户空间的内存区域,进程使用堆栈作为临时存储. .堆栈中存放的是函数中的局部变量,在函数的生命周期中可以将变量压入堆栈,编译器需要确保堆栈指针在函数退出前恢复到初始位置,也就是说 ...

  4. 全面介绍Windows内存管理机制及C++内存分配实例(六):堆栈

    本文背景: 在编程中,很多Windows或C++的内存函数不知道有什么区别,更别谈有效使用:根本的原因是,没有清楚的理解操作系统的内存管理机制,本文企图通过简单的总结描述,结合实例来阐明这个机制. 本 ...

  5. java 缓冲区溢出_浅析缓冲区溢出

    最近一直在学习缓冲区溢出漏洞的攻击,但是关于这一块的内容还是需要很多相关知识的基础,例如编程语言及反汇编工具使用.所以研究透彻还需要不少的时间,这里简单的做一个学习的总结,通过具体的实验案例对缓冲区溢 ...

  6. java 异常堆栈输出_打印Java异常堆栈信息

    背景 在开发Java应用程序的时候,遇到程序抛异常,我们通常会把抛异常时的运行时环境保存下来(写到日志文件或者在控制台中打印出来).这样方便后续定位问题. 需要记录的运行时环境包含两部分内容:抛异常时 ...

  7. c++频繁读取数据会丢失_异常堆栈信息丢失?到底是怎么回事?

    01 即时编译优化 Java程序在运行初期是通过解释器来执行,当发现某块代码运行特别频繁,就会将之判定为热点代码(Hot Spot Code), 虚拟机会将这部分代码编译成本地机器码,并对这些代码进行 ...

  8. 堆栈跟踪 堆栈跟踪_过滤日志中无关的堆栈跟踪行

    堆栈跟踪 堆栈跟踪 我喜欢堆栈痕迹. 不是因为我喜欢错误,而是因为发生错误的那一刻,堆栈跟踪是无价的信息源. 例如,在Web应用程序中,堆栈跟踪向您显示完整的请求处理路径,从HTTP套接字到过滤器,S ...

  9. matlab溢出的标志inf,关于C#:溢出与信息

    当我在Matlab中输入一个大于max double的数字时,例如10^309,它的值大约为1.79769e+308,则返回Inf. 出于教育目的,我想获取像C编译器这样的溢出异常,该异常返回一个溢出 ...

最新文章

  1. 学javascript有哪些开发工具
  2. android w700
  3. 【Kotlin】扩展属性 ( 扩展变量属性 | 扩展常量属性 | 注意事项 | 本质分析 )
  4. Linux 历史命令巧用
  5. Boost:点质心的测试程序
  6. OpenCV图像列表创建者imagelist creator的实例(附完整代码)
  7. php搜索数据库设计,PHP数据库搜索功能设计
  8. 计算机网络在实践中的应用,计算机网络技术及在实践中的应用
  9. 配置hadoop 使用fair scheduler调度器
  10. 小白python语言基础
  11. [leetcode]5178. 四因数
  12. asp前端日历_ASP+JavaScript的完整的日历使用-ASP教程,ASP应用
  13. 评分卡模型之数据预处理
  14. 十大OpenGL教程
  15. 2022年全新PHP程序开发在线工单管理系统源码,售后工单系统
  16. JSD-2204-(业务逻辑开发)-发酷鲨商城front模块-开发购物车功能-Day09
  17. 2017年网易推出他们的“淘宝客”啦
  18. 面试题,互联网产品的盈利模式有哪些?
  19. 流量分析(wireshark使用)
  20. 【MODIS数据处理#13】使用Arcpy一键加工长时间序列MODIS数据

热门文章

  1. 【2018-8月】win7 32位旗舰纯净+装机版系统(每月更新)
  2. python_特征离散化Binarizerdigitize
  3. 使用 K3s 和 WireGuard 网络快速部署一个多云环境的 Kubernetes 集群
  4. 基于小程序的微信学习平台设计与实现+源码
  5. Apache Atlas 1.2.0 安装部署
  6. http://www.cnblogs.com/procoder/
  7. 微信小程序使用自定义字体的三种方法
  8. 一次维修打印机复印件的记录
  9. excel md5 加密
  10. MRT(MODIS Reprojection Tool) 使用教程