Print Numbers from 1 to 1000 Without Loops or Conditionals in C/C++

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

569 Views

Here we will see how to print 1 to 1000 without loop or any conditional statements. As the loops cannot be used, so we can try recursions, but here another constraint that, we cannot use the conditions also. So the base case of the recursion will not be used.Here we are solving this problem using static members. At first we are initializing the static member with 1, then in the constructor we are printing the value and increase its value. Now create an array of 1000 objects of that class, so 1000 different objects are created, so the constructor is ... Read More

Resolve Error 1111: Invalid Use of Group Function in MySQL

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

2K+ Views

To correctly use aggregate function with where clause in MySQL, the following is the syntax −select *from yourTableName where yourColumnName > (select AVG(yourColumnName) from yourTableName);To understand the above concept, let us create a table. The query to create a table is as follows −mysql> create table EmployeeInformation    -> (    -> EmployeeId int,    -> EmployeeName varchar(20),    -> EmployeeSalary int,    -> EmployeeDateOfBirth datetime    -> ); Query OK, 0 rows affected (1.08 sec)Now you can insert some records in the table using insert command. The query is as follows −mysql> insert into EmployeeInformation values(101, 'John', 5510, '1995-01-21'); ... Read More

Get Duplicate Values from ArrayList in Android

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

1K+ Views

This example demonstrate about How to get the duplicates values from Arraylist and then get those items in another Arraylist.Step 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.     In the above code, we have taken listview to show duplication list items from array list.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; public class MainActivity extends AppCompatActivity ... Read More

What is Java Server Pages (JSP) and Why JSP is Preferred Over CGI

Samual Sam
Updated on 30-Jul-2019 22:30:25

1K+ Views

JavaServer Pages (JSP) is a technology for developing Webpages that support dynamic content. This helps developers insert java code in HTML pages by making use of special JSP tags, most of which start with .A JavaServer Pages component is a type of Java servlet that is designed to fulfill the role of a user interface for a Java web application. Web developers write JSPs as text files that combine HTML or XHTML code, XML elements, and embedded JSP actions and commands.Using JSP, you can collect input from users through Webpage forms, present records from a database or another source, and ... Read More

Apply Choose Tag in JSP

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

291 Views

The works like a Java switch statement in that it lets you choose between a number of alternatives. Where the switch statement has case statements, the tag has tags. Just as a switch statement has the default clause to specify a default action, has as the default clause.AttributeThe tag does not have any attribute.The tag has one attributes which is listed below.The tag does not have any attribute.The tag has the following attributes −AttributeDescriptionRequiredDefaulttestCondition to evaluateYesNoneExample           Tag Example             ... Read More

LocalDate Query Method in Java

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

167 Views

The LocalDate object can be queried as required using the query method in the LocalDate class in Java. This method requires a single parameter i.e. the query to be invoked and it returns the result of the query.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; import java.time.temporal.*; public class Demo { public static void main(String[] args) { LocalDate ld = LocalDate.parse("2019-02-14"); System.out.println("The LocalDate is: " + ld); String precision = ld.query(TemporalQueries.precision()).toString(); ... Read More

Deploy Scrapy Spider on Scrapinghub

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

204 Views

Scrapy spiderScrapy spider is a class which provides the facility to follow the links of a website and extract the information from the webpages.This is the main class from which other spiders must inherit.ScrapinghubScrapinghub is an open source application to run Scrapy spiders. Scrapinghub turns web content into some useful data or information. It allows us to extract the data from webpages, even for complex webpages.We are going to use scrapinghub to deploy scrapy spiders on cloud and execute it.Steps to deploy spiders on scrapinghub −Step1 −Create one scrapy project −After installing scrapy, just run the following command in your ... Read More

Why MySQL Refuses Pipe Character in String on Insert

Chandu yadav
Updated on 30-Jul-2019 22:30:25

300 Views

To insert pipe(|) character in string on INSERT INTO, let us first see an example and create a table. The query to create a table is as followsmysql> create table PipeInsertDemo -> ( -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> UserPassword varchar(100) -> ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into PipeInsertDemo(UserPassword) values('John123|'); Query OK, 1 row affected (0.15 sec) mysql> insert into PipeInsertDemo(UserPassword) values('|123456CarolTaylor'); Query OK, 1 row affected ... Read More

Operate on All Databases from the MongoDB Shell

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

161 Views

To operate on all databases from MongoDB shell, you can use listDatabases along with adminCommand().Let’s say we are using a sample database “test”. At first, check the current database with the help of db command.Following is the query to get the current database> db;This will produce the following outputTestFollowing is the query to operate on all the databases from the Mongo shell> var allDatabaseList = db.adminCommand('listDatabases');Now you need to use printjson() in order to print all databases. Following is the query> printjson (allDatabaseList);This will produce the following output{    "databases" : [       {         ... Read More

Need of Long Data Type in C

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

402 Views

In C or C++, there are four different datatypes, that are used for integer type data. These four datatypes are short, int, long and long long. Each of these datatypes takes different memory spaces. The size varies in different architecture and different operating systems. Sometimes int takes 4-bytes or sometimes it takes 2-bytes. This also happen for the compilers. So we can use cross compilers.The cross compilers are basically a compiler, which is capable of compiling for a platform other than current platform.So if we want to compile the following code in 32bit system, and 64-bit system, it will generate ... Read More

Advertisements