definition

What is the meaning of “exclusive” and “inclusive” when describing number ranges?

萝らか妹 提交于 2019-12-02 23:05:44
Simple question but, I see exclusive and inclusive when referring to number ranges. For example, this is a line from an algorithms book: The following function prints the powers of 2 from 1 through n (inclusive). What is meant by this? What makes a number range inclusive or exclusive? Tim Biegeleisen The following function prints the powers of 2 from 1 through n (inclusive). This means that the function will compute 2^i where i = 1, 2, ..., n , in other words, i can have values from 1 up to and including the value n . i.e n is Included in Inclusive If, on the other hand, your book had said:

namespaces, classes and free functions - when do you need fully qualified names

穿精又带淫゛_ 提交于 2019-12-02 21:12:07
In my example below, why do I have to fully qualify the name of the free function in the cpp to avoid linker errors and why does it work for the class function without? Can you explain the difference? ctest.h: namespace Test { int FreeFunction(); class CTest { public: CTest(); ~CTest(); }; } ctest.cpp: #include "ctest.h" using namespace Test; // int FreeFunction() -> undefined reference error int Test::FreeFunction() -> works just fine { return 0; } CTest::CTest() -> no need to fully qualify name, i.e. Test::CTest {} CTest::~CTest() {} Thanks for your time & help. int FreeFunction(void); is

Does Qt offer a (guaranteed) debug definition?

六月ゝ 毕业季﹏ 提交于 2019-12-02 19:56:41
Does anyone know an officially supported way to include debug-build only code in Qt? For example: #ifdef QT_DEBUG // do something #endif Basically like Q_ASSERT but for more complex tests. I can't seem to find any documentation which says that the Qt framework guarantees to define a debug macro. If there isn't, what would be a sensible unofficial way to implement this feature project wide? Qt defines QT_NO_DEBUG for release builds. Otherwise QT_DEBUG is defined. Of course you are free to specify any DEFINES in your .pro files and scope them for either debug or release . eSKon An alternative is

Javascript - difference between namespace vs. closure?

≡放荡痞女 提交于 2019-12-02 19:43:38
In Javascript, what's the difference between a namespace and a closure? They seem very similar to me. EDIT Specifically, this article discusses namespaces and closures, and has sentences like Now, we’re still going to have situations where we’ll want to declare variables that don’t naturally fit into a namespaced object structure. But we don’t want those variables to have a global scope. This is where self-invoking functions come in. It goes on to give what looks a lot like a closure, as an "object namespace". It looks to me like the namespace IS a closure ...but maybe it's not...? Help? A

What is data serialization ?

…衆ロ難τιáo~ 提交于 2019-12-02 19:05:52
First of all, I could not able to get clear definition of it from WikiPedia or even from serialize function in the PHP manual. I need to know some cases we need the term serialization and how things are going without it? In other word, Where you must need serialization and without it your code will be missing some important feature. What serialization is? Serialization is objects encoding into other language. For example you have an array in PHP like this: $array = array("a" => 1, "b" => 2, "c" => array("a" => 1, "b" => 2)); And then you want to store it in file or send to other application.

What is a code cave, and is there any legitimate use for one?

心不动则不痛 提交于 2019-12-02 18:06:28
I encountered this word for the first time in the StackOverflow question " C# Theoretical: Write a JMP to a codecave in asm ." I see that according to Wiktionary , a code cave is: an unused block of memory that someone, typically a software cracker, can use to inject custom programming code to modify the behavior of a program. Did I find the correct definition? If so, is there any legitimate use for a code cave? I've used them, although I'd never heard the term code cave until today. The Wiktionary definition suggests that a code cave is something the cracker finds in the executable he or she

C++ global variable initialization order

痴心易碎 提交于 2019-12-02 17:55:41
I don't understand what the following code example does and how it does it: #include <stdio.h> int f(); int a = f(); // a exists just to call f int x = 22; int f() { ++x; return 123; // unimportant arbitrary number } int main() { printf("%d\n", x); } When this is ran it prints 23 , which is the intuitive answer. However in C++, global variables are supposed to be initialized in order of definition. That would mean that a should be initialized before x , because it is defined before x . If that was the case, then the function f would have to be called before x was initialized, because the call

What is an activity, a context and an intent in Android? [closed]

自古美人都是妖i 提交于 2019-12-02 17:31:26
Can somebody please explain to me what an activity, a context and an intent in Android are? I read the Android documentation, but I could not understand these concepts. K.Muthu Activity : represents the presentation layer of an Android application, e.g. a screen which the user sees. An Android application can have several activities and it can be switched between them during runtime of the application. ContentProvider : provides data to applications, via a content provider your application can share data with other applications. Android contains a SQLite DB which can serve as the data provider

REST - What exactly is meant by Uniform Interface?

我们两清 提交于 2019-12-02 16:47:15
Wikipedia has: Uniform interface The uniform interface constraint is fundamental to the design of any REST service.[14] The uniform interface simplifies and decouples the architecture, which enables each part to evolve independently. The four guiding principles of this interface are: Identification of resources Individual resources are identified in requests, for example using URIs in web-based REST systems. The resources themselves are conceptually separate from the representations that are returned to the client. For example, the server may send data from its database as HTML, XML or JSON,

How to show zsh function definition (like bash “type myfunc”)?

雨燕双飞 提交于 2019-12-02 14:49:49
How do I show the definition of a function in zsh? type foo doesn't give the definition. In bash: bash$ function foo() { echo hello; } bash$ foo hello bash$ type foo foo is a function foo () { echo hello } In zsh: zsh$ function foo() { echo hello; } zsh$ foo hello zsh$ type foo foo is a shell function The zsh idiom is whence , the -f flag prints function definitions: zsh$ whence -f foo foo () { echo hello } zsh$ In zsh, type is defined as equivalent to whence -v , so you can continue to use type , but you'll need to use the -f argument: zsh$ type -f foo foo () { echo hello } zsh$ And, finally,