Sunday, 9 February 2014

Creating a Digital Clock using an Applet in Java...


Here is Full Code To Create a Digital through JAVA Applet


import java.awt.*;
import java.awt.Graphics;
import java.applet.Applet;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DGClock extends Applet {
    DateFormat dateFormat;
    Date date;
    Thread t;
    public void init() {
        this.setSize(300,200);
    }
    public void paint(Graphics g)
    {
        try
        {
            Font f=new Font("Arial",Font.BOLD,50);
            g.setFont(f);
            g.setColor(Color.DARK_GRAY);
            dateFormat = new SimpleDateFormat("hh:mm:ss a");
            date = new Date();
            g.drawString(dateFormat.format(date),5,100);
            Font f1=new Font("Arial",Font.BOLD,10);
            g.setFont(f1);
            g.drawString("For More Example Visit : exceptionthroow.blogspot.in",20,170);
            g.drawString("Email : agotariyanilesh@gmail.com",65,185);
            showStatus("Developed By : Nilesh Agotariya");
            t.sleep(1000);
            repaint();
        }catch(Exception e)
        {
        
        }
    }
}


Thursday, 6 February 2014

Program of Stack in C Language with full functionality PHSH,POP,PEEP,SEARCH,DISPLAY,UPDATE


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int tos=-1;
int data[5];
void MENU();
void PUSH();
void POP();
void PRINT();
void PEEP();
void UPDATE();
void SEARCH();
void MSG(char msg[]);
void main()
{
       MENU();
       getch();
}
void MENU()
{
int ch;
clrscr();
printf("\n\t----Menu----");
printf("\n\n\t 1. PUSH \n\t 2. POP \n\t 3. PEEP \n\t 4. UPDATE \n\t 5. SEARCH \n\t 6. DISPLAY \n\t 7. EXIT ");
printf("\n\n\t Enter Your Choice : ");
scanf("%d",&ch);
switch(ch)
{
case 1:
PUSH();
break;
case 2:
POP();
break;
case 3:
PEEP();
break;
case 4:
UPDATE();
break;
case 5:
SEARCH();
break;
case 6:
PRINT();
break;
case 7:
exit(0);
break;
default:
MSG("Invalid Choice");
}
}
void PUSH()
{
if(tos<4)
{
int item;
clrscr();
printf("\n\t Enter Item : ");
scanf("%d",&item);
tos++;
data[tos]=item;
MENU();
}else
{
MSG("Stack is Full");
}
}
void POP()
{
if(tos>-1)
{
clrscr();
printf("\n\t Deleted Item is : %d",data[tos]);
tos--;
getch();
MENU();
}else
{
MSG("\n\t Stack is Empty");
}
}
void PEEP()
{
if(tos>-1)
{
int pos;
clrscr();
printf("\n\t Enter Which Element You Want to See : ");
scanf("%d",&pos);
pos=tos-pos+1;
printf("\n\n\t Element is : ");
scanf("%d",data[pos]);
getch();
MENU();
}else
{
MSG("\n\t Stack is Empty");
}
}
void UPDATE()
{
if(tos>-1)
{
int pos,ele;
clrscr();
printf("\n\t Enter Position to Update Element : ");
scanf("%d",&pos);
printf("\n\t Enter Value : ");
scanf("%d",&ele);
pos=tos-pos+1;
data[pos]=ele;
MSG("\n\t Record Updated");
getch();
MENU();
}else
{
MSG("Stack is Empty");
}

}
void SEARCH()
{
if(tos>-1)
{
int i,ele,cnt=0;
clrscr();
printf("\n\t Enter Element to Search : ");
scanf("%d",&ele);
for(i=0;i<=tos;i++)
{
if(data[i]==ele)
{
cnt++;
}
}
if(cnt>0)
{
printf("\n\t Element %d  Found %d times in the Stack",ele,cnt);
}else
{
      printf("\n\t Element Not Found");
}
getch();
MENU();
}else
{
MSG("\n\t Stack is Empty");
}
}
void PRINT()
{
if(tos>-1)
{
int i;
clrscr();
for(i=0;i<=tos;i++)
{
printf("\n\t Element At Position %d is : %d",i,data[i]);
}
getch();
MENU();
}else
{
MSG("\n\t Stack is Empty");
}
}
void MSG(char msg[])
{
printf("\n\t %s ",msg);
getch();
MENU();
}

Wednesday, 5 February 2014

How to Hide Drive From My Computer or How to Unmount Drive From Your Computer

To Hide The Drive You have to follow some Steps

STEP 1: Check Drives in My Computer

STEP 2 : Open RUN and type diskpart and press OK

STEP 3 : Now You have to Write Commands...
               list volume

STEP 4 : Now You Will see all the Drives were listed. Now you have to select one of the drive that you want to hide or unmount and for do this command is 
               select volume 4
After selection of drive you have to remove the drive for that command is
          remove letter e
 


STEP 5 : Now goto My Computer You Will Not See the Drive E:\ and even you can not access it also
STEP 6: Now How to get back the Drive for that command is
              select volume 4
              assign letter e

STEP 7 : Now You Can Access or See your Drive

How to Create an Datepicker using JAVA SWING

Program of JAVA Datepicker.....


package datepicker;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class DatePicker {
int month = java.util.Calendar.getInstance().get(java.util.Calendar.MONTH);
int year = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR);;
JLabel l = new JLabel("", JLabel.CENTER);
String day = "";
JDialog d;
JButton[] button = new JButton[49];

public DatePicker(JFrame parent) {
d = new JDialog();
d.setModal(true);
String[] header = { "Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat" };
JPanel p1 = new JPanel(new GridLayout(7, 7));
p1.setPreferredSize(new Dimension(430, 120));

for (int x = 0; x < button.length; x++) {
final int selection = x;
button[x] = new JButton();
button[x].setFocusPainted(false);
button[x].setBackground(Color.white);
if (x > 6)
button[x].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
day = button[selection].getActionCommand();
d.dispose();
}
});
if (x < 7) {
button[x].setText(header[x]);
button[x].setForeground(Color.red);
}
p1.add(button[x]);
}
JPanel p2 = new JPanel(new GridLayout(1, 3));
JButton previous = new JButton("<< Previous");
previous.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
month--;
displayDate();
}
});
p2.add(previous);
p2.add(l);
JButton next = new JButton("Next >>");
next.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
month++;
displayDate();
}
});
p2.add(next);
d.add(p1, BorderLayout.CENTER);
d.add(p2, BorderLayout.SOUTH);
d.pack();
d.setLocationRelativeTo(parent);
displayDate();
d.setVisible(true);
}

public void displayDate() {
for (int x = 7; x < button.length; x++)
button[x].setText("");
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
"MMMM yyyy");
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(year, month, 1);
int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
for (int x = 6 + dayOfWeek, day = 1; day <= daysInMonth; x++, day++)
button[x].setText("" + day);
l.setText(sdf.format(cal.getTime()));
d.setTitle("Date Picker");
}

public String setPickedDate() {
if (day.equals(""))
return day;
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
"dd-MM-yyyy");
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(year, month, Integer.parseInt(day));
return sdf.format(cal.getTime());
}
}

class Picker {
public static void main(String[] args) {
JLabel label = new JLabel("Selected Date:");
final JTextField text = new JTextField(20);
JButton b = new JButton("Date");
JPanel p = new JPanel();
p.add(label);
p.add(text);
p.add(b);
final JFrame f = new JFrame("exceptionthroow.blogspot.in");
f.getContentPane().add(p);
f.pack();
f.setVisible(true);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
text.setText(new DatePicker(f).setPickedDate());
}
});
}
}



OUTPUT : -






Send Email From Localhost Using PHPMailer

How to send an Email from Localhost using wamp or xamp server through PHPMailer
Steps that you have to follow.
For WAMP SERVER
  • start wamp server
  • goto Apache -> Apache Modules ->Enable ssl_module
  • now goto php -> php extensions -> Enable php_openssl
  • now goto php -> php extensions -> Enable php_sockets
  • now goto php -> php extensions -> Enable php_smtp
  • Note if You not found php_smtp then Download php_smtp.dll
  • place this dll file to this location
  • C:\wamp\bin\php\php5.4.3\ext
  • Now it’s time to modify php.ini file
  • goto php -> php.ini















                    now Find “Dynamic extension”
  •           place any where in this section:  extension=php_smtp.dll
  •           Now restart the XAMPSERVER…
  •          Download Package From Here…..
  •          Now run sendMail.php
    FOR XAMP Server
    No configration required just download example given above and run it…
    I Hope this will help you for any other help please contact agotariyanilesh@gmail.com
    Thanks..