definition

What is instrumentation?

I've heard this term used a lot in the same context as logging, but I can't seem to find a clear definition of what it actually is. Is it simply a more general class of logging/monitoring tools and activities? Please provide sample code/scenarios when/how instrumentation should be used. ...

Error 'duplicate definition' when compiling two C files that reference one header file

I have two C files and one header that are as follows: Header file header.h: char c = 0; file1.c: #include "header.h" file2.c: #include "header.h" I was warned about 'duplicate definition' when compiling. I understand the cause as the variable c is defined twice in both file1.c and file2.c; however, I do need to reference the h...

Pseudocode: a clear definition?

The following code is an example of what I think would qualify as pseudocode, since it does not execute in any language but the logic is correct. string checkRubric(gpa, major) bool brake = false num lastRange num rangeCounter string assignment = "unassigned" array bus['business']= array('person a'=>array(0, 2.9), 'p...

What can I do with an enum variable?

When I declare a enum variable like this: enum paint_colors { RED, GREEN, BLUE, ...} colors; is the colors variable useful? If so, what can I do with it? Thanks in advance. ...

Java declarations (ordering)

In Java, what's generally the most accepted way to organize a class in terms of the order in which declared data members and methods should be listed in the class file, keeping in mind the following and anything else you can think of for each one: its visibility whether it's a constructor, method, or member if it's a method, does it ov...

Task vs. process, is there really any difference?

Hi there, I'm studying for my final exams in my CS major on the subject distributed systems and operating systems. I'm in the need for a good definition for the terms task, process and threads. So far I'm confident that a process is the representation of running (or suspended, but initiated) program with its own memory, program counter...

Question about variable definitions in functions.

Hi. #include <stdio.h> main() { int a; for(a=1; a<=4 && printf("%d ",a); a++) { int a; static int b=a; printf("%d ",(a++)-b); } getchar(); getchar(); } In this code, the printout is 1 0 2 1 3 2 4 3. I understand why the int a; part works differently than the int a which was defined ou...

variable names in function definition, call and declaration

Hi, I see C books that use the same variable names in the function definition, calling function and declaration. Others use the same variable names in the calling function and in the declaration/prototype but a different one in the definition as in: void blabla(int something); //prototype blabla(something) // calling function inside m...

What are Windows code pages?

I'm trying to gain a basic understanding of what is meant by a Windows code page. I kind of get the feeling it's a translation between a given 8 bit value and some 'abstraction' for a given character graphic. I made the following experiment. I created a "" character literal with two versions of the letter u with an umlaut. One create...

Strange constructor

Well, I'm gonna be pretty straightforward here, I just have a piece of code in c++ which I'm not sure I really understand and need some help with. Ok, to simplify lets just say I have a class that is defined like this: (the real class is a little bit more complicated, but this is what matters) class myClass : public Runnable { Sema...

Vim: Redefine a command

In vim, in my .vimrc, how can I redefine a command (i.e. :e) as something else? I want to redefine :e * as :tabe *. ...

PHP Markdown Extra and Definition Lists

I'm currently generating a definition list with PHP Markdown Extra with the following syntax: Term : Description : Description Two My Other Term : Description which generates the following HTML: <dl> <dt>Term</dt> <dd>Description</dd> <dd>Description Two</dd> <dt>My Other Term</dt> <dd>Description</dd> </dl...

Why do I have to specify pure virtual functions in the declaration of a derived class in Visual C++?

Given the base class A and the derived class B: class A { public: virtual void f() = 0; }; class B : public A { public: void g(); }; void B::g() { cout << "Yay!"; } void B::f() { cout << "Argh!"; } I get errors saying that f() is not declared in B while trying do define void B::f(). Do I have to declare f() explicitly i...

What kind of language is CSS?

What kind of language is CSS? My first inclination was to call it a markup language... but it doesn't really fit the mold. Edit: A markup language is a system for annotating a text in a way which is syntactically distinguishable from that text. -wikipedia CSS uses various selectors to apply properties to elements within HTM...

STL Static-Const Member Definitions

How does the following work? #include <limits> int main() { const int* const foo = &std::numeric_limits<int> ::digits; } I was under the impression that in order to take an address of a static const-ant member we had to physically define it in some translation unit in order to please the linker. That said, after looking at the prep...

What is the difference between an object's scope and it's context in javascript?

In the vernacular, scope and context have a lot in common. Which is why I get confused when I read references to both, such as in the quote below from an article on closures: Scope refers to where variables and functions are accessible, and in what context it is being executed. (@robertnyman) As far as I can tell, context is just ...

Trivial Q about redefinition.

Why this isn't allowed: int a = 0; int a = 0; but this is: for (int i = 0; i < 2; ++i) { int a = 0; } As far as I know code inside for loop will be executed twice whitout actually going out of its scope, so it should also be an error to define a twice. Looking forward to your answers Thanks. ...

What exactly do "IB" and "UB" mean?

I've seen the terms "IB" and "UB" used several times, particularly in the context of C++. I've tried googling them, but apparently those two-letter combinations see a lot of use. :P So, i ask you...what do they mean, if they're said like it's a bad thing? ...

What is the origin of "launch the missiles"?

In the context of functional programming, a typical example of a side effect is "launch the missiles". I was just wondering where that expression comes from historically. ...

How is push()ing and pop()ping defined?

I know how the push() and pop() methods in a typical implementation of a Queue/Linked List work but what I do want to know is what you actually define as a push or a pop? When can you name a method push()/pop()? What makes the insert()/add() method in a typical Tree implementation not a push()? My understanding is that push()ing means p...