C++ is a general purpose programming language that is considered a mid-level language due to its leniency towards both high-level and low-level functionalities. In 1979, an employee of Bell Labs, Dr. Bjarne Stroustrup, developed C++ as an improvement on the existing C programming language, a result of an idea he had while programming for his Ph.D. thesis. Dr. Bjarne Stroustrup originally called his enhancement “C with classes”; it was renamed to C++ in 1983. The standards used by C++ were officially sanctioned as ISO/IEC 14882:1998, of which 2003 is the Read More
Preprocessor Directives
The C++ preprocessor is a program that is executed before the source code is compiled. A preprocessor command is called directives. It begins with a hash symbol (#). No white space should appear before the # and a semi colon is not required at the end of the statement. Things that can be done during the preprocessing stage are: Inclusion of the header file through #include directive Definition of a symbolic constant and macros through #define directive The #define preprocessor allows us to define symbolic names and constants. For example: Read More
SQL Injection Attack / Vulnerability
A SQL injection vulnerability can occur when a poorly-written program uses user-provided data in a database query without first validating the input. This is most-often found within web pages with dynamic content. There are some excellent tutorials and descriptive articles on this subject, as well as many vulnerability postings for different applications from full-disclosure websites. A simple example of SQL injection is a basic HTML form login in which you provide a username and password: <form method=”post” action=”process_login.php”> <input type=”text” name=”username”> <input type=”password” name=”password”> </form> Given this snippet of HTML, Read More
Linear Queue
Implementation of operations on a linear queue: Creating an Empty Queue Before we can use a queue, it must be created. The purpose of initializing the queue is served by assigning -1 (as a sentinel value) to the front and rear variables. Note that the valid range of an index for the array is 0 to CAPACITY-1. .cf { font-family: Lucida Console; font-size: 9pt; color: black; background: white; } .cl { margin: 0px; } .cb1 { color: green; } .cb2 { color: blue; } .cb3 { color: maroon; } void Read More
Functions – Pass by value
Functions A function is a named unit of a group of program statements. This unit can be invoked from other parts of the program. A programmer can solve a simple problem in C++ with a single function. Difficult and complex problems can be decomposed into sub-problems, each of which can be either coded directly or further decomposed. Decomposing difficult problems, until they are directly code-able as single C++ functions, is a software engineering method of stepwise refinement. These functions are combined into other functions and are ultimately used in main() Read More
Java Package
A Java package is a set of classes which are grouped together. This grouping helps to organize Java classes and codevent multiple Java classes with the same name. Using Java Packages To use a package in your Java source code, you must either import the package or use the fully qualified class name each time you use a class. Using Fully Qualified Class Names This example uses the Ammunition class from the ballistics package: ballistics.Ammunition caliber = new ballistics.Ammunition(); As you can imagine, using fully qualified class names can become Read More
JNI (Java Native Interface)
JNI is the Java Native Interface. JNI is an interface between Java and applications and libraries written in other languages. As an example, JNI enables Java programs to use C libraries and also enables C programs to use Java classes. JNI is distributed as part of the JDK.
J2EE
J2EE is Java 2 Enterprise Edition. J2EE is Sun’s preferred Java platform for multi-tier enterprise applications. J2EE enhances J2SE with: Enterprise JavaBeans components Java Servlets API JavaServer Pages XML For more information on J2EE, visit J2EE.
Insertion of an Element in a Heap
An element is initially inserted as the last child of the heap. On insertion, the heap remains a complete binary tree, but the order property may be violated. We have to perform a series of operations to move the element up from the last position until either it ends up in a position where the order property is satisfied or we hit the root node. In this tutorial, we refer to this process as the reheapify upward operation. Algorithm ReheapifyUpward(heap,start) Here heap is a linear array and start is the Read More
Depth First Search Algorithm
A DFS algorithm, as the name implies, is used to search deeper in the graph, whenever possible. The edges are explored, out of the most recently discovered vertex v that still has unexplored edges leaving it. When all of v's edges have been explored, the search backtracks to explore edges leaving the vertex from which v was discovered. This process continues until we have discovered all the vertices that are reachable from the source vertex. DFS uses stack structure to maintain the order in which the vertices are to be Read More
Share on: