• 我发现在python中定义的全局变量在使用的时候，代码报错nboundLocalError: local variable 'best_teacher_val' referenced before assignment，于是开始解决 2、解决 我定义的全局变量 被使用的地方 解决 ...
目录

1、简介
2、解决
3、参考

1、简介
我发现在python中定义的全局变量在使用的时候，代码报错nboundLocalError: local variable 'best_teacher_val' referenced before assignment，于是开始解决
2、解决
我定义的全局变量

被使用的地方

解决

展开全文
• Before the best interests of the child. New York: The Free Press, 1979, 288 pp., [dollar]4.95 (paper) 410 Book Reviews one advocated by the authors, is the teaching of strategies; that is, the ...
• Before You RefactorRajith AttapattuAT SOME POiNT, every programmer will need to refactor existing code. But before you do so, please think about the following, as this could save you and others a ...
Before You Refactor
Rajith Attapattu
AT SOME POiNT, every programmer will need to refactor existing code. But before you do so, please think about the following, as this could save you and others a great deal of time (and pain):  • The best approach for restructuring starts by taking stock of the existing codebase and the tests written against that code. This will help you under- stand the strengths and weaknesses of the code as it currently stands, so you can ensure that you retain the strong points while avoiding the mistakes. We all think we can do better than the existing system…until we end up with something no better—or even worse—than the previous incarnation because we failed to learn from the existing system’s mistakes.  • Avoid the temptation to rewrite everything. It is best to reuse as much code as possible. No matter how ugly the code is, it has already been tested, reviewed, etc. Throwing away the old code—especially if it was in production—means that you are throwing away months (or years) of tested, battle-hardened code that may have had certain workarounds and bug fixes you aren’t aware of. If you don’t take this into account, the new code you write may end up showing the same mysterious bugs that were fixed in the old code. This will waste a lot of time, effort, and knowledge gained over the years.  ￼￼12  97 Things Every Programmer Should Know  •  Many incremental changes are better than one massive change. Incremen- tal changes allows you to gauge the impact on the system more easily through feedback, such as from tests. It is no fun to see a hundred test failures after you make a change. This can lead to frustration and pressure that can in turn result in bad decisions. A couple of test failures at a time is easier to deal with, leading to a more manageable approach.  ￼  ￼￼￼￼￼￼￼￼￼￼￼￼￼￼￼• After each development iteration, it is important to ensure that the existing tests pass. Add new tests if the existing tests are not sufficient to cover the changes you made. Do not throw away the tests from the old code with- out due consideration. On the surface, some of these tests may not appear to be applicable to your new design, but it would be well worth the effort to dig deep down into the reasons why this particular test was added.  • Personal preferences and ego shouldn’t get in the way. If something isn’t broken, why fix it? That the style or the structure of the code does not meet your personal preference is not a valid reason for restructuring. Thinking you could do a better job than the previous programmer is not a valid reason, either.  • New technology is an insufficient reason to refactor. One of the worst reasons to refactor is because the current code is way behind all the cool technol- ogy we have today, and we believe that a new language or framework can do things a lot more elegantly. Unless a cost-benefit analysis shows that a new language or framework will result in significant improvements in functionality, maintainability, or productivity, it is best to leave it as it is.  • Remember that humans make mistakes. Restructuring will not always guarantee that the new code will be better—or even as good as—the pre- vious attempt. I have seen and been a part of several failed restructuring attempts. It wasn’t pretty, but it was human.
展开全文
• ￼Try Before ChoosingErik DoernenburgCREATing An AppliCATion REquiRES MAKing MAny dECiSionS. Some might involve choosing a framework or library, while others revolve around the use of specific design ...
￼
Try Before Choosing
Erik Doernenburg
CREATing An AppliCATion REquiRES MAKing MAny dECiSionS. Some might involve choosing a framework or library, while others revolve around the use of specific design patterns. In either case the responsibility for the decision generally lies with the architect on the team. A stereotypical architect might gather all the information that can be gathered, then mull over it for a while, and finally decree the solution from the ivory tower for it to be imple- mented by the developers. Not surprisingly, there is a better way.  In their work on lean development, Mary and Tom Poppendieck describe a technique for making decisions. They argue that we should delay commitment until the last responsible moment; that is, the moment at which, if the team does not make a decision, it is made for them—when inaction results in an outcome that is not (easily) reversible. This is prudent because the later a deci- sion is made, the more information is available on which to base the decision. However, in many cases more information is not the same as enough informa- tion, and we also know that the best decisions are made in hindsight. What does this mean for the good architect?  The architect should constantly be on the lookout for decisions that will have to be made soon. Provided the team has more than a handful of developers and practices collective code ownership, the architect can, when such a deci- sion point approaches, ask several developers to come up with a solution to the problem and go with it for a while. As the last responsible moment approaches, the team meets to assess the benefits and drawbacks of the different solutions.  ￼  ￼￼Usually, now with the benefit of hindsight, the best solution to the problem is apparent to everybody. The architect does not have to make the decision, he or she merely orchestrates the decision-making process.  This approach works for small decisions as well as for large ones. It can allow a team to figure out whether or not to use the Hibernate templates provided by the Spring framework, but it can equally answer the question of which JavaScript framework to use. The duration for which the different approaches evolve is obviously very dependent on the complexity of the decision.  Trying two or even more approaches to the same problem requires more effort than making a decision upfront and then just implementing one. However, chances are that an upfront decision leads to a solution that is later recognized to be suboptimal, leaving the architect with a dilemma: either the team rolls back the current implementation or it lives with the consequences, both of which result in wasted effort. Even worse, it is entirely possible that nobody on the team recognizes that the approach chosen is not the best one, because none of the alternatives was explored. In this case, effort is wasted without any chance of addressing the waste. After all, trying multiple approaches might be the least expensive option.
展开全文
• Chapter 1: Before You Start Chapter 2: Android Patterns Chapter 3: Performance Chapter 4: Agile Android Chapter 5: Native Development Chapter 6: Security Chapter 7: Device Testing Chapter 8: Web ...
• Ref 1（参考High-Performance Communication networks，高性能通信网络中的定义）802.11的核心思想还是基于Best-effort。Best-effort的定义包含两个部分： IP的承载服务就是以数据报形式发送报文，报文的最大程度为2...
笔者仅仅整理一些笔者目前看到的资料，没有总结，考虑清楚以后再总结。
Ref 1（参考High-Performance Communication networks，高性能通信网络中的定义）
802.11的核心思想还是基于Best-effort。Best-effort的定义包含两个部分：
IP的承载服务就是以数据报形式发送报文，报文的最大程度为2^{16}字节（64KB）。这种服务在差错，网络延迟或带宽方面不提供服务质量保证。这样的服务叫做尽力而为（Best-effort）服务，表示网络将尽量提供服务。（参考第103页，4.3.1节中的描述）IP承载服务在延迟，带宽和数据丢失方面不能提供任何保证，路由器按同一种方式处理所有的分组（这种“一视同仁”的处理方式也可以叫做尽力而为（Best-effort）服务）。这是一种很自然的特点：缺乏状态信息就意味着分组不能够被应用或链接所区别，这样路由器就不能提供额外的资源以满足应用需求。（参考第120页，4.5中的描述）
Ref 2 (https://wenku.baidu.com/view/a3989dbbfd0a79563c1e725e.html)，第33页
Ref 3  (IEEE 802.11 无线局域网，工业电子出版社)，第27页，3.1.1节
Ref 4  (https://www.techwalla.com/articles/difference-between-synchronous-and-asynchronous-data-transfer)
Synchronous
In synchronous data transfers, the sender and receiver take some time to communicate before they make the exchange. This communication outlines the parameters of the data exchange. This usually involves establishing which end, sender or receiver, will be in control of the transfer. Here, the two parties also ensure they are using the same timing; that is, they know when each burst ends and another begins. They also set parameters for resetting their clocks during the transfer to make sure they don’t drift away from the agreed-upon timing.Asynchronous
In asynchronous, or “best effort” transfers, sender and receiver do not establish the parameters of the information exchange. Rather, the sender places extra bits of data before and after each burst that indicate when each burst begins and ends. It then sends the information, and it is up to the receiver to determine how to reset its clock to match the timing of the signal. Unlike synchronous transfers, the receiver does not take time to communicate to the sender information about what it received.
展开全文
• 题目1：Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie,
• his paper provides a framework and guidelines for best practices that Oracle ® Forms product users can adopt and adapt.. The paper does not seek to impose a set of ideas and standards, but rather ...
• Best Practices for Speeding Up Your Web Site
• – Use ingest pipelines to transform and enrich before indexing • Coordinating Nodes – Route requests, handle search reduce phase, distribute bulk indexing – All nodes function as coordinating ...
• The best programmer I know is my technical co-founder at Framebase.io (Tyler Menezes). I don’t know how he does it but he kicks my ass at Google.  You know the famous quote: “Never ...
• magento se105模版的底部，默认有recent viewed和best seller这两个模块。有些人可能不需要这两个模块。因为它影响网页的美观度。 像我的网站，首页就不需要这两个模块，但是目录页和产品也需要这两个模块，因为它...
• Best practices for the logging REST API In a large-scale distributed environment, the log data may be the only information that is available to the developer for debugging issues. Auditing and log
• 想用GATK germline best practice的方法进行突变的分析。这里主要参考GATK Germline best practice的教程。1 这里用的是GATK3.7的版本，目前已经出到GATK3.8。最近4.0也发布了。 部分步骤后续补完。。。 ...
• java之Database Performance Best Practices Spend time evaluating the best JDBC driver for the application. The best driver will often vary depending on the specific deployment. The same ...
• this book demonstrates how to apply design patterns and best practices in real-life situations, whether that's for new or already existing projects. It will help you to make your applications more ...
• * Use before_filter Lesson 6. View * Move code into controller * Move code into helper * Replace instance variable with local variable Ruby5 不久前在2009年11月17日的Podcast中介绍了rails_best_...
• ppt: https://www.slideshare.net/unity3d/best-practices-for-shader-graph With Shader Graph in Unity 2018, creating powerful and beautiful shaders has never been easier. But with great power, comes g.....
• Leetcode 经典题Best Time to Buy and Sell Stock||
• Best Practices of Software Engineering2ObjectivesWhat we will learn: Best Practices of Software Engineering3Best Practices Reinforce Each OtherBest PracticesDevelop IterativelyManage RequirementsUse
• 使OllyDbg v1.10看起来像是Immunity Debugger和Best Plugins ***这是一个过时的旧回购协议，仅供参考*** 使用该软件的风险自负，对于因使用该软件而对您的计算机造成的任何损坏，我概不负责。 plugin list ...
• Web 站点提速的最佳实践（Best Practices for Speeding Up Your Web Site）
• The book covers how to create and manage a repository on Git before moving on to explain the best practices to work with other developers as a team. It provides descriptions of Git's features, such as...
• 7. ERP software best practices and pre-configured solutions do not solve all of the  challenges of ERP. 最佳解决方案也不会解决你所有的问题。 8. SaaS ERP won’t eliminate all of your ...
• Best Time to Buy and Sell Stock  Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction ...
• Link:http://money.usnews.com/careers/best-jobs/rankings/the-100-best-jobs ...The 100 Best Jobs All jobs aren’t created equal. In fact, some are simply better than the rest. U.S. News 100 Best...
• EDW to an ever-widening set of users and applications than ever before. In order to keep up with this increase in demand the EDW must now be near real-time and be highly available. How do you know if ...
• It’s common sense that peer code review – in which software developers review each other’s code before releasing software to QA – identifies bugs, encourages collaboration, and keeps code more ...
• Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as
• UnboundLocalError:local variable 'XXX' referenced before assignment 只在函数里面引用外面定义的变量而不改变它的值不会报错，如果要改变外面定义的变量的值则需要用到全局变量。 解决办法： 在函数开头用...

...