Auto Insert Values into a MySQL Table in a Range

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

1K+ Views

For this, you can create a stored procedure. Let us first create a table.mysql> create table DemoTable    -> (    -> Value int    -> ); Query OK, 0 rows affected (0.55 sec)Following is the query to create a stored procedure to auto insert values to a table from range 10 to 20 −mysql> DELIMITER // mysql> CREATE PROCEDURE AutoInsertValuesToTable()    -> BEGIN    ->    DECLARE startingRange INT DEFAULT 10;    ->    WHILE startingRange       INSERT DemoTable(Value) VALUES (startingRange );    ->       SET startingRange = startingRange + 1;    ->   ... Read More

Print a Matrix in Diagonal Pattern

Venkata Sai
Updated on 30-Jul-2019 22:30:26

1K+ Views

Following is the Java program to print diagonal pattern of a given matrix.Example Live Demopublic class DiagonalMatrix {    public static void main(String args[]){       int a[][]={{1,2,3},{4,5,6},{7,8,9}};       int rows = a.length;       int columns = a[0].length;       for (int i = 0; i < rows; i++) {          for (int r = i, c = 0; r >= 0 && c < columns; r--, c++){             System.out.print(a[r][c] + " ");          }          System.out.println();       }       for (int i = 1; i < columns; i++) {          for (int r = rows-1, c = i; r >= 0 && c < columns; r--, c++) {             System.out.print(a[r][c] + " ");          }          System.out.println();       }    } }Output1 4 2 7 5 3 8 6 9

HTML DOM setNamedItem Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

166 Views

The DOM setNamedItem() method set a node specified in its parameter to an attribute node using its name in an HTML document.SyntaxFollowing is the syntax −node.setNamedItem(node);ExampleLet us see an example of setNamedItem() method − Live Demo    html{       height:100%;    }    body{       text-align:center;       color:#fff;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat;       height:100%;    }    .btn{       background:#0197F6;       border:none;       height:2rem;       border-radius:2px;       width:50%;       margin:2rem auto; ... Read More

Bash Program to Find A to the Power B

Arnab Chakraborty
Updated on 30-Jul-2019 22:30:26

3K+ Views

Here we will see how to get the number A raise to the power B using bash script. The logic is very simple. We have to use the ‘**’ operator or power operator to do this. Let us see the following program to understand the concept clearly.Example#!/bin/bash # GNU bash Script a=5 b=6 echo "$(($a ** $b))"Output15625

Output Colored Text to a Linux Terminal

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

8K+ Views

Here we will see how to print some lines into the linux terminal with some color. Here we are doing anything special into C++ code. We are just using some linux terminal commands to do this. The command for this kind of output is like below.\033[1;31m Sample Text \033[0mThere are some codes for text styles and colors. These are listed below.ColorForeground CodeBackground CodeBlack3040Red3141Green3242Yellow3343Blue3444Magenta3545Cyan3646White3747Some additional options are like below −OptionCodeDescriptionReset0Back to normal (remove all styles)Bold1Bold the textUnderline4Underline textInverse7Interchange colors of background and foregroundBold off21Normal from boldUnderline off24Normal from UnderlineInverse off27Reverse of the InverseExample#include using namespace std; main() {    cout Read More

Where Are the App Cookies Stored on the iPhone

Smita Kapse
Updated on 30-Jul-2019 22:30:26

4K+ Views

Cookies are small files which are stored on a user's device while browsing internet.When we talk about cookies in iPhone we usually talk about application using the Web Views or the browser applications.A normal iOS application does not contains cookies. An app will have cookies only if the application has one or more web views.To check where are the app cookies stored on iPhone, On an iPhone, go to Settings -> Safari -> Advanced -> Website Data and you will see all cookies stored on your device.For iOS Application using web view The UIWebView will automatically store the cookies in the sharedHTTPCookieStorage.Read More

Create Reminder Notification in Android

Anvi Jain
Updated on 30-Jul-2019 22:30:26

4K+ Views

This example demonstrate about How to Create a Reminder Notification in AndroidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.package app.tutorialspoint.com.notifyme ; import android.app.AlarmManager ; import android.app.PendingIntent ; import android.content.Intent ; import android.os.Bundle ; import android.support.v7.app.AppCompatActivity ; import android.view.View ; import java.util.Calendar ; public class MainActivity extends AppCompatActivity {    @Override    protected void onCreate (Bundle savedInstanceState) {       super .onCreate(savedInstanceState) ... Read More

The Hidden Terminal Problem

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

26K+ Views

In wireless LANs ( wireless local area networks), the hidden terminal problem is a transmission problem that arises when two or more stations who are out of range of each other transmit simultaneously to a common recipient. This is prevalent in decentralised systems where there aren’t any entity for controlling transmissions. This occurs when a station is visible from a wireless access point (AP), but is hidden from other stations that communicate with the AP.Problem IllustrationSuppose that there are three stations labelled STA, STB, and STC, where STA and STC are transmitting while STB is receiving. The stations are in ... Read More

Get Number of Siblings of a Node in JTree with Java

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

252 Views

Use the getSiblingCount() method to get the number of siblings of a node in JTree. For example, let’s say we have a node, which isn’t a root node. For that, we will find the sibling count −node1.getSiblingCount()The following is an example to get the number of siblings of a node −package my; import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; public class SwingDemo {    public static void main(String[] args) throws Exception {       JFrame frame = new JFrame("Demo");       DefaultMutableTreeNode node = new DefaultMutableTreeNode("Project");       DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("QA");       DefaultMutableTreeNode node2 ... Read More

Compare Multiple Properties in MongoDB

George John
Updated on 30-Jul-2019 22:30:26

177 Views

To compare multiple properties, use the $where operator. Let us first create a collection with documents −> dbcomparingMultiplePropertiesDemoinsertOne({"Values":[10, 70, 60]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cf228fcb64a577be5a2bc0a") }Following is the query to display all documents from a collection with the help of find() method −> dbcomparingMultiplePropertiesDemofind()pretty();This will produce the following document −{    "_id" : ObjectId("5cf228fcb64a577be5a2bc0a"),    "Values" : [       10,       70,       60    ] }Case 1: If condition becomes true then you will get an array otherwise nothing will get displayed Following is the query to compare multiple ... Read More

Advertisements