Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Nishtha Thakur
398 articles
How to properly integrate HTML5 Boilerplate with Twitter Bootstrap?
To integrate HTML5 Boilerplate with Twitter Bootstrap, you can use the Initializr. It is an HTML5 templates generator that allows you to create a customized HTML5 boilerplate with Bootstrap components included. Using Initializr for Integration Initializr provides a web-based interface where you can select HTML5 Boilerplate as your base template and add Bootstrap framework on top of it. This creates a clean, production-ready starting point for your web projects. Example Integration Here's what a basic integrated HTML5 Boilerplate with Bootstrap looks like − ...
Read MoreUse CSS max-width property responsive for video player
You can try to run the following code to use a max-width property to make your video player responsive −Example video { max-width: 100%; height: auto; } To check the effect, you need to resize the browser.
Read MoreHow to detect all active JavaScript event handlers?
The simplest solution is to use jQuery to detect all active JavaScript event handlers.ExampleYou can try to run the following code to detect active event handlers var myEvent = $("#demo"); myEvent.mouseover(function() {}); $.each(myEvent.data("events"), function(i, e) { alert(i); }); Demo Text
Read MoreC++ Program to Implement Johnson’s Algorithm
Here we will see the Johnson’s Algorithm to find shortest path between two vertices. The graph is given here. The shortest path between the edges is like below. This program will take the number of vertices, number of edges, and the edges with their costs.Input − Vertices: 3Edges: 5Edge with costs −1 2 82 1 121 3 223 1 62 3 4Output − The distance matrix of the graph.081210046140AlgorithmjohnsonAlgorithm(cost)Input − The cost matrix of given Graph.Output − Matrix to for shortest path between any vertex to any vertex.Begin Create another matrix ‘A’ same as cost matrix, if there is no ...
Read MoreC program that won’t compile in C++
The C++ language is designed by adding some additional features like Object Oriented concepts with C. Most of the C programs can be compiled using C++ compiler also. Though there are some programs that cannot be compiled using C++ compiler.Let us see some code, that will compile in C compiler, but not in C++ compilers.In this program there will be one compilation error for C++ code. Because it is trying to call a function that is not declared before. But in C it may compileLive Demo For C.Example#include int main() { myFunction(); // myFunction() is called before its declaration ...
Read MoreWhen should we write our own assignment operator in C++?
Here we will see when we need to create own assignment operator in C++. If a class do not have any pointers, then we do not need to create assignment operator and copy constructor. C++ compiler creates copy constructor and assignment operator for each class. If the operators are not sufficient, then we have to create our own assignment operator.Example#include using namespace std; class MyClass { //no user defined assignment operator or copy constructor is present int *ptr; public: MyClass (int x = 0) { ptr = new int(x); } void setValue (int x) { *ptr = x; } void print() { cout
Read MoreC++ Program to Perform Searching Based on Locality of Reference
Searching based on locality of reference, depends upon the memory access pattern data elements are reallocated.Here linear searching method is used to search an element.AlgorithmBegin int find(int *intarray, int n, int item) intialize comparisons = 0 for i = 0 to n-1 Increase comparisons if(item == intarray[i]) Print element with its index break if(i == n-1) Print element not found return -1 Print Total comparisons For j = i till i>0 intarray[j] = intarray[j-1] intarray[0] = ...
Read MoreLongStream forEachOrdered() method in Java
The forEachOrdered() method in Java performs an action for each element of this stream, guaranteeing that each element is processed in encounter order for streams that have a defined encounter order.The syntax is as follows −void forEachOrdered(LongConsumer action)Here, parameter wrapper is a non-interfering action to perform on the elements. LongConsumer represents an operation that accepts a single long-valued argument and returns no result.To use the LongStream class in Java, import the following package −import java.util.stream.LongStream;The following is an example to implement LongStream forEachOrdered() method in Java −Exampleimport java.util.*; import java.util.stream.LongStream; public class Demo { public static void main(String[] ...
Read MorePointers, smart pointers and shared pointers in C++
PointersPointers are used to store the address of variable.SyntaxType *pointer;InitializationType *pointer; Pointer = variable name;Functionspointers are used to store address of variable.pointers can have a null value assigned.pointer can be referenced by pass by reference.a pointer has its own memory address and size on the stack.Example#include using namespace std; int main() { // A normal integer variable int a = 7; // A pointer variable that holds address of a. int *p = &a; // Value stored is value of variable "a" cout
Read MoreSet vs Map in C++ STL
Set is an abstract data type in which each element has to be unique because the value of the element identifies it. The value of the element cannot be modified once it is added to the set, but it is possible to remove and add the modified value of that element.A Map is an associative container that store elements in a mapped fashion. Each element has a key value and a mapped value. No two mapped values can have the same key values.So, it is clear from above that, set contains the only key, and map contains a value with ...
Read More