definition

Separate policy from mechanism: What does it mean?

喜欢而已 提交于 2019-12-04 23:12:32
I've often heard the mantra of "separating policy from mechanism", especially in the context of the Unix philosopy. What does this mean and what are some concrete examples of it? When/why is/isn't it a good thing? It is basically the separation of requirements or business function from technical implementation. The mechanism is the technical implementation. The implementation allows and supports the ability for the business to implement its business policy. Example: A security mechanism may be set up allow for users to be attached to groups and for users and groups to be attached to

What is the definition of Convenience Method in regards to Objective C?

泄露秘密 提交于 2019-12-04 20:22:59
问题 In most languages I have dealt with, one something is called a convenience method, it means that the method does some small task that gets done very frequently, and therefore it is more convenient to use said method. In Objective-C does this definition hold true? Or is it generally only used to describe class methods that return a prebuilt object? ex. [NSString stringWithContentsOfFile:...] Is this just a preference thing, or are there some hard and fast definition for these terms? Cheers,

Difference between framework and container?

北战南征 提交于 2019-12-04 19:57:37
I was reading this question on SO: Framework vs. Toolkit vs. Library where is explained difference between framework and library. General opinion is that main difference is in Inversion of Control, so you have hot spots in framework where you attach your application functionality (in essence you choose between inheritance/template/heavyweight or composition/strategy/lightweight to achieve that). Ok, now I am curious what is difference between framework and container then? I saw following definition of container (by Rod Johnson): "Container is framework in which application code/objects runs".

Matlab: dynamic name for structure

半腔热情 提交于 2019-12-04 19:24:27
I want to create a structure with a variable name in a matlab script. The idea is to extract a part of an input string filled by the user and to create a structure with this name. For example: CompleteCaseName = input('s'); USER WRITES '2013-06-12_test001_blabla'; CompleteCaseName = '2013-06-12_test001_blabla' casename(12:18) = struct('x','y','z'); In this example, casename(12:18) gives me the result test001 . I would like to do this to allow me to compare easily two cases by importing the results of each case successively. So I could write, for instance : plot(test001.x,test001.y,test002.x

What is the difference between “compile time” and “run time”?

廉价感情. 提交于 2019-12-04 17:48:24
问题 I do not understand what is meant by the terms "compile time" and "run time" (or "runtime"). I'm also a bit confused about what "value type" and "reference type" mean, and how they relate to the 'times mentioned above. Would someone please explain these things? 回答1: "Compile time" is when you build your code - when the compiler converts your source code into IL. "Runtime" is when your code is executed - for ASP.NET, when a page request is made. (Personally I prefer the term "execution time"

Why is it called "open (or closed) recursion?

自闭症网瘾萝莉.ら 提交于 2019-12-04 16:12:23
问题 I found some explanations of open/closed recursion, but I do not understand why the definition contains the word "recursion", or how it compares with dynamic/static dispatching. Among the explanations I found, there are: Open recursion. Another handy feature offered by most languages with objects and classes is the ability for one method body to invoke another method of the same object via a special variable called self or, in some languages, this . The special behavior of self is that it is

Scala: order of definition for companion object vs case class

情到浓时终转凉″ 提交于 2019-12-04 16:11:49
问题 In Scala 2.9.1 I get the following behavior: class Foo { case class X() object X // this compiles def bar() { object Y // this compiles case class Y() case class Z() object Z // won't compile (see below) } } The compiler complains for Object Z : error: Z is already defined as (compiler-generated) case class companion object Z It looks as if it is not permissible to define a companion object for a case class after the case class definition if they are within a function definition. Is this a

What does an if look like in IL?

旧巷老猫 提交于 2019-12-04 13:18:49
What does an if statement look like when it's compiled into IL? It's a very simple construct in C#. Can sombody give me a more abstract definition of what it really is? Here are a few if statements and how they translate to IL: ldc.i4.s 0x2f var i = 47; stloc.0 ldloc.0 if (i == 47) ldc.i4.s 0x2f bne.un.s L_0012 ldstr "forty-seven!" Console.WriteLine("forty-seven!"); call Console::WriteLine L_0012: ldloc.0 if (i > 0) ldc.i4.0 ble.s L_0020 ldstr "greater than zero!" Console.WriteLine("greater than zero!"); call Console::WriteLine L_0020: ldloc.0 bool b = (i != 0); ldc.i4.0 ceq ldc.i4.0 ceq stloc

Should I define my Cython function using def, cdef, or cpdef for optimal performance?

寵の児 提交于 2019-12-04 07:32:31
How can I know whether to use def, cdef or cpdef when defining a Cython function, assuming I want optimal performance? If you want optimal performance, you should know that as mentioned in this answer to a related question: Once the function has been called there is no difference in the speed that the code inside a cdef and a def function runs at. So for optimal Cython performance you should always statically type all arguments and variables , and intuitively you would then be tempted to use cdef , but there are some caveats for which I constructed the flowchart below (also based on previously

What is machine learning? [closed]

旧街凉风 提交于 2019-12-04 07:21:03
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What is machine learning ? What does machine learning code do ? When we say that the machine learns, does it modify the code of itself or it modifies history (database) which will contain the experience of code for given set of inputs? 回答1: What is a machine learning ? Essentially, it is a method of teaching