# Multiple file Upload using Apache Commons and JSP

Hi Friends,

Recently i was in a situation where i needed  to upload multiple files at one go in jsp.(Not Servelet 😦  )

So here is the simple code I’ve made to upload Multiple Files to Desired Folder at Server.

index page

Db Page :

Feel free to comment if you have any doubts.

Thanks 🙂

Hey friends,

Recently I developed a project where in required to download the whole website for offline usage.

As I’ve a linux based OS i’d the option of using httrack was cancelled.

So quickly i wrote a script to download using the wget command.

# Jget program Like Wget

Hi Friends ,

Today we will build a program similar like Wget functionality in Linux.

Feel free to comment and share.

# Project Euler #1: Multiples of 3 and 5

Hi Friends ,

From today onwards I will be solving problems based on the Project Euler.

You can access the site from here. Today is the First Problem of Euler.

Find the sum of all the multiples of 3 or 5 .

Input Format

First line contains T that denotes the number of test cases. This is followed by T lines, each containing an integer,  N

Output Format

For each test case, print an integer that denotes the sum of all the multiples of 3 or 5 below N .

So here is the code of the first problem :

Feel free to comment.

# Send Emails through JSP(Java server Page)

Hi , Every one Today we are going to learn a simple jsp code to send email .

There might me n no. of situations where in you may require to a page where in you need to send email.

Following code might save you

To achieve this we require two libraries

1. mail-1.4.1.jar
2. activation-1.1.1.jar

So the code

The code itself is self explanatory.
Just insert the

• authAddress with the sender email id
• smtpPort    with your smtp server port
• subject   with subject for your email

And run , it will start shooting emails as you click on Send

Else you can clone the Project

git clone https://github.com/ShubhamS32/JSPMailer.git

Feel free to comment 🙂

# Pre & Post increment operator example Java

Hi,

Today we will be Finding the difference between pre- and post- increment of variables.

Pre -increment Operator:

int x=1; System.out.println("x:"+x); System.out.println("x:"+(++x)); System.out.println("x:"+x); 

Post -increment Operator:

int x=1; System.out.println("x:"+x); System.out.println("x:"+x++); System.out.println("x:"+x); 

So what will be output you think??

For Post – increment Operator:

Output:

 x:1 x:1 x:2 

For Pre -increment Operator:
Output:
 x:1 x:2 x:2 

Explanation:

For pre – increment operator :

System.out.println(“x:”+x);  //Display value of x i.e 1

System.out.println(“x:”+(++x));  //First increase the value of x and then display i.e 2

System.out.println(“”x:”+x);  //Display value of x i.e 2

For post -increment operator :

System.out.println(“x:”+x);  //Display value of x i.e 1

System.out.println(“x:”+(x++));  //First display the value of x and then increment i.e 1

System.out.println(“”x:”+x);  //Display the incremented value of x i.e 2

That’s it so simple of Pre increment and Post increment Operation in Java.

Note: The operator (++) is called as Increment Operator and (–) is called as Decrement operator and these both Operator fall under the category of Unary Operator.

Feel free to comment 🙂

# Differences between C++ & Java

By the way , C++ is also an object oriented programming language , just like Java. But there are some important features wise differences , between C++ and Java.

Let’s have a glance at them :

C++ Jva
1 C++ is not a purely object-oriented programming language
, since its possible to write C++ programs without using a class or an object.
Java is purely an object – oriented programming language ,
since it’s not possible to write Java program without construction of class.
2 Pointers are available in C++. We cannot create and use pointers in Java
3 Allocation and deallocation memory is the responsibility of the programmer. Here its taken care by JVM
4 Automatic casting is available in C++. In some cases , implicit casting is available , but one should use casting when required
5 C++ has goto statements. Its forbidden in java.
6 Multiple inheritance feature is available in C++. No Multiple inheritance in Java , but one can achieve in using Interface 🙂
7 There are 3 access specifiers in C++:
1)private
2)protected
3)public
Java supports 4 access specifiers:
1)private
2)protected
3)public
4)default
8 There are constructors and destructors in C++ . Only Constructors are available.

These where some of the key points that differentiate between C++ and Java.