Monday, May 13, 2013

Make mitten for your cutiepie

Cut 2 pices in mitten shape from felt and sew them together. You can decorate it with ribbon.

Tuesday, April 30, 2013

Nail Art Using Pin/ Toothpick

Hey Girls
If you love to play with your nails then there is one simple trick for doing nail art using pin/ toothpick

Apply Base coat to the nail. and apply any shade which you want to apply.After 2-3 minutes dip the pin to nail polish and then to the nail.

Then after drying it apply top coat. It will stay 6-7 days.

You can design HEART, DOTS, Rain Drops, Paints falling and many more

Saturday, August 27, 2011

How To Mobile Redirect Your Website On Any Mobile Device

< script language="javascript" >

var redirectagent = navigator.userAgent.toLowerCase();
var redirect_devices = ['vnd.wap.xhtml+xml', 'sony', 'symbian', 'nokia', 'samsung', 'mobile', 'windows ce', 'epoc', 'opera mini', 'nitro', 'j2me', 'midp-', 'cldc-', 'netfront', 'mot', 'up.browser', 'up.link', 'audiovox', 'blackberry', 'ericsson', 'panasonic', 'philips', 'sanyo', 'sharp', 'sie-', 'portalmmm', 'blazer', 'avantgo', 'danger', 'palm', 'series60', 'palmsource', 'pocketpc', 'smartphone', 'rover', 'ipaq', 'au-mic', 'alcatel', 'ericy', 'vodafone', 'wap1', 'wap2', 'teleca', 'playstation', 'lge', 'lg-', 'iphone', 'android', 'htc', 'dream', 'webos', 'bolt', 'nintendo'];
for (var i in redirect_devices) {
if (redirectagent.indexOf(redirect_devices[i]) != -1) {
location.replace("http://111.93.42.228:9090/mifeelingswap/index.php");
}
}
< /script>

Friday, March 18, 2011

mouse_tail pointer

Try it only in IE and mozila not in chrome. It will not support Google Chrome...
<html>
<head>
<title>Mouse Tail Clock</title>
</head>
<body>
<SCRIPT language=JavaScript>
dCol='000000';//date colour.
fCol='000000';//face colour.
sCol='000000';//seconds colour.
mCol='000000';//minutes colour.
hCol='000000';//hours colour.
ClockHeight=40;
ClockWidth=40;
ClockFromMouseY=0;
ClockFromMouseX=100;
d=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");
m=new Array("JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER");
date=new Date();
day=date.getDate();
year=date.getYear();
if (year < 2000) year=year+1900;
TodaysDate=" "+d[date.getDay()]+" "+day+" "+m[date.getMonth()]+" "+year;
D=TodaysDate.split('');
H='...';
H=H.split('');
M='....';
M=M.split('');
S='.....';
S=S.split('');
Face='1 2 3 4 5 6 7 8 9 10 11 12';
font='Arial';
size=1;
speed=0.6;
ns=(document.layers);
ie=(document.all);
Face=Face.split(' ');
n=Face.length;
a=size*10;
ymouse=0;
xmouse=0;
scrll=0;
props="<font face="+font+" size="+size+" color="+fCol+"><B>";
props2="<font face="+font+" size="+size+" color="+dCol+"><B>";
Split=360/n;
Dsplit=360/D.length;
HandHeight=ClockHeight/4.5
HandWidth=ClockWidth/4.5
HandY=-7;
HandX=-2.5;
scrll=0;
step=0.06;
currStep=0;
y=new Array();x=new Array();Y=new Array();X=new Array();
for (i=0; i < n; i++){y[i]=0;x[i]=0;Y[i]=0;X[i]=0}
Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();
for (i=0; i < D.length; i++){Dy[i]=0;Dx[i]=0;DY[i]=0;DX[i]=0}
if (ns){
for (i=0; i < D.length; i++)
document.write('<layer name="nsDate'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props2+D[i]+'</font></center></layer>');
for (i=0; i < n; i++)
document.write('<layer name="nsFace'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+Face[i]+'</font></center></layer>');
for (i=0; i < S.length; i++)
document.write('<layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></layer>');
for (i=0; i < M.length; i++)
document.write('<layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+mCol+'><center><b>'+M[i]+'</b></center></font></layer>');
for (i=0; i < H.length; i++)
document.write('<layer name=nsHours'+i+' top=0 left=0 width=15 height=15><font face=Arial size=3 color='+hCol+'><center><b>'+H[i]+'</b></center></font></layer>');
}
if (ie){
document.write('<div id="Od" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < D.length; i++)
document.write('<div id="ieDate" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props2+D[i]+'</B></font></div>');
document.write('</div></div>');
document.write('<div id="Of" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < n; i++)
document.write('<div id="ieFace" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center">'+props+Face[i]+'</B></font></div>');
document.write('</div></div>');
document.write('<div id="Oh" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < H.length; i++)
document.write('<div id="ieHours" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold">'+H[i]+'</div>');
document.write('</div></div>');
document.write('<div id="Om" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < M.length; i++)
document.write('<div id="ieMinutes" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center;font-weight:bold">'+M[i]+'</div>');
document.write('</div></div>')
document.write('<div id="Os" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
for (i=0; i < S.length; i++)
document.write('<div id="ieSeconds" style="position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold">'+S[i]+'</div>');
document.write('</div></div>')
}
(ns)?window.captureEvents(Event.MOUSEMOVE):0;
function Mouse(evnt){
ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;
}
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
function ClockAndAssign(){
time = new Date ();
secs = time.getSeconds();
sec = -1.57 + Math.PI * secs/30;
mins = time.getMinutes();
min = -1.57 + Math.PI * mins/30;
hr = time.getHours();
hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360;
if (ie){
Od.style.top=window.document.body.scrollTop;
Of.style.top=window.document.body.scrollTop;
Oh.style.top=window.document.body.scrollTop;
Om.style.top=window.document.body.scrollTop;
Os.style.top=window.document.body.scrollTop;
}
for (i=0; i < n; i++){
var F=(ns)?document.layers['nsFace'+i]:ieFace[i].style;
F.top=y[i] + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;
F.left=x[i] + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);
}
for (i=0; i < H.length; i++){
var HL=(ns)?document.layers['nsHours'+i]:ieHours[i].style;
HL.top=y[i]+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;
HL.left=x[i]+HandX+(i*HandWidth)*Math.cos(hrs);
}
for (i=0; i < M.length; i++){
var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes[i].style;
ML.top=y[i]+HandY+(i*HandHeight)*Math.sin(min)+scrll;
ML.left=x[i]+HandX+(i*HandWidth)*Math.cos(min);
}
for (i=0; i < S.length; i++){
var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds[i].style;
SL.top=y[i]+HandY+(i*HandHeight)*Math.sin(sec)+scrll;
SL.left=x[i]+HandX+(i*HandWidth)*Math.cos(sec);
}
for (i=0; i < D.length; i++){
var DL=(ns)?document.layers['nsDate'+i]:ieDate[i].style;
DL.top=Dy[i] + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;
DL.left=Dx[i] + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);
}
currStep-=step;
}
function Delay(){
scrll=(ns)?window.pageYOffset:0;
Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed);
Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed);
for (i=1; i < D.length; i++){
Dy[i]=Math.round(DY[i]+=(Dy[i-1]-DY[i])*speed);
Dx[i]=Math.round(DX[i]+=(Dx[i-1]-DX[i])*speed);
}
y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);
x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);
for (i=1; i < n; i++){
y[i]=Math.round(Y[i]+=(y[i-1]-Y[i])*speed);
x[i]=Math.round(X[i]+=(x[i-1]-X[i])*speed);
}
ClockAndAssign();
setTimeout('Delay()',20);
}
if (ns||ie)window.onload=Delay;
</SCRIPT>
<table border="1">
<tr><td>1</td><td>Hello</td></tr>
<tr><td>2</td><td> </td></tr>
</table>
</body></html>

Image slide show in html

<html>
<head>
<script type="text/javascript">
<!--
var image1=new Image()
image1.src="1.jpg"
var image2=new Image()
image2.src="2.jpg"
var image3=new Image()
image3.src="3.jpg"
//-->
</script>
</head>
<body>
<EMBED src="Sham.mp3" autostart=true hidden=true>
<EMBED src="Behke Behke.mp3" autostart=true hidden=true>
<img src="firstcar.gif" name="slide" width="100" height="56" />
<script>
<!--
//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<3)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",2500)
}
slideit()
//-->
</script>
</body>
</html>

Friday, January 21, 2011

Record Your Voice and Listen it

Hey Friends I am working on Java sound API. Its a Simple program in which you record your voice and listen it. In this what you have to do is that press capture button and start recording press the stop button to stop recording and press play back button to listen your recorded message.

File name is AudioCapture01.java


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.sound.sampled.*;

public class AudioCapture01
extends JFrame{

boolean stopCapture = false;
ByteArrayOutputStream
byteArrayOutputStream;
AudioFormat audioFormat;
TargetDataLine targetDataLine;
AudioInputStream audioInputStream;
SourceDataLine sourceDataLine;

public static void main(
String args[]){
new AudioCapture01();
}//end main

public AudioCapture01(){//constructor
final JButton captureBtn =
new JButton("Capture");
final JButton stopBtn =
new JButton("Stop");
final JButton playBtn =
new JButton("Playback");

captureBtn.setEnabled(true);
stopBtn.setEnabled(false);
playBtn.setEnabled(false);

//Register anonymous listeners
captureBtn.addActionListener(
new ActionListener(){
public void actionPerformed(
ActionEvent e){
captureBtn.setEnabled(false);
stopBtn.setEnabled(true);
playBtn.setEnabled(false);
//Capture input data from the
// microphone until the Stop
// button is clicked.
captureAudio();
}//end actionPerformed
}//end ActionListener
);//end addActionListener()
getContentPane().add(captureBtn);

stopBtn.addActionListener(
new ActionListener(){
public void actionPerformed(
ActionEvent e){
captureBtn.setEnabled(true);
stopBtn.setEnabled(false);
playBtn.setEnabled(true);
//Terminate the capturing of
// input data from the
// microphone.
stopCapture = true;
}//end actionPerformed
}//end ActionListener
);//end addActionListener()
getContentPane().add(stopBtn);

playBtn.addActionListener(
new ActionListener(){
public void actionPerformed(
ActionEvent e){
//Play back all of the data
// that was saved during
// capture.
playAudio();
}//end actionPerformed
}//end ActionListener
);//end addActionListener()
getContentPane().add(playBtn);

getContentPane().setLayout(
new FlowLayout());
setTitle("Capture/Playback Demo");
setDefaultCloseOperation(
EXIT_ON_CLOSE);
setSize(250,70);
setVisible(true);
}//end constructor

//This method captures audio input
// from a microphone and saves it in
// a ByteArrayOutputStream object.
private void captureAudio(){
try{
//Get everything set up for
// capture
audioFormat = getAudioFormat();
DataLine.Info dataLineInfo =
new DataLine.Info(
TargetDataLine.class,
audioFormat);
targetDataLine = (TargetDataLine)
AudioSystem.getLine(
dataLineInfo);
targetDataLine.open(audioFormat);
targetDataLine.start();

//Create a thread to capture the
// microphone data and start it
// running. It will run until
// the Stop button is clicked.
Thread captureThread =
new Thread(
new CaptureThread());
captureThread.start();
} catch (Exception e) {
System.out.println(e);
System.exit(0);
}//end catch
}//end captureAudio method

//This method plays back the audio
// data that has been saved in the
// ByteArrayOutputStream
private void playAudio() {
try{
//Get everything set up for
// playback.
//Get the previously-saved data
// into a byte array object.
byte audioData[] =
byteArrayOutputStream.
toByteArray();
//Get an input stream on the
// byte array containing the data
InputStream byteArrayInputStream
= new ByteArrayInputStream(
audioData);
AudioFormat audioFormat =
getAudioFormat();
audioInputStream =
new AudioInputStream(
byteArrayInputStream,
audioFormat,
audioData.length/audioFormat.
getFrameSize());
DataLine.Info dataLineInfo =
new DataLine.Info(
SourceDataLine.class,
audioFormat);
sourceDataLine = (SourceDataLine)
AudioSystem.getLine(
dataLineInfo);
sourceDataLine.open(audioFormat);
sourceDataLine.start();

//Create a thread to play back
// the data and start it
// running. It will run until
// all the data has been played
// back.
Thread playThread =
new Thread(new PlayThread());
playThread.start();
} catch (Exception e) {
System.out.println(e);
System.exit(0);
}//end catch
}//end playAudio

//This method creates and returns an
// AudioFormat object for a given set
// of format parameters. If these
// parameters don't work well for
// you, try some of the other
// allowable parameter values, which
// are shown in comments following
// the declarations.
private AudioFormat getAudioFormat(){
float sampleRate = 8000.0F;
//8000,11025,16000,22050,44100
int sampleSizeInBits = 16;
//8,16
int channels = 1;
//1,2
boolean signed = true;
//true,false
boolean bigEndian = false;
//true,false
return new AudioFormat(
sampleRate,
sampleSizeInBits,
channels,
signed,
bigEndian);
}//end getAudioFormat
//===================================//

//Inner class to capture data from
// microphone
class CaptureThread extends Thread{
//An arbitrary-size temporary holding
// buffer
byte tempBuffer[] = new byte[10000];
public void run(){
byteArrayOutputStream =
new ByteArrayOutputStream();
stopCapture = false;
try{//Loop until stopCapture is set
// by another thread that
// services the Stop button.
while(!stopCapture){
//Read data from the internal
// buffer of the data line.
int cnt = targetDataLine.read(
tempBuffer,
0,
tempBuffer.length);
if(cnt > 0){
//Save data in output stream
// object.
byteArrayOutputStream.write(
tempBuffer, 0, cnt);
}//end if
}//end while
byteArrayOutputStream.close();
}catch (Exception e) {
System.out.println(e);
System.exit(0);
}//end catch
}//end run
}//end inner class CaptureThread
//===================================//
//Inner class to play back the data
// that was saved.
class PlayThread extends Thread{
byte tempBuffer[] = new byte[10000];

public void run(){
try{
int cnt;
//Keep looping until the input
// read method returns -1 for
// empty stream.
while((cnt = audioInputStream.
read(tempBuffer, 0,
tempBuffer.length)) != -1){
if(cnt > 0){
//Write data to the internal
// buffer of the data line
// where it will be delivered
// to the speaker.
sourceDataLine.write(
tempBuffer, 0, cnt);
}//end if
}//end while
//Block and wait for internal
// buffer of the data line to
// empty.
sourceDataLine.drain();
sourceDataLine.close();
}catch (Exception e) {
System.out.println(e);
System.exit(0);
}//end catch
}//end run
}//end inner class PlayThread
//===================================//

}//end outer class AudioCapture01.java

Email with Java and JSP

Hey frnds. I am back with some more codes.

If you want to use mail api in your application or website you can use this code.
I am writing here codes in JAVA and JSP both.

import javax.mail.*;
import java.io.*;
import java.util.*;
import javax.mail.Session;
import javax.mail.Message;
import javax.mail.Transport;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.InternetAddress;
import java.util.Properties;
import javax.mail.internet.*;
import javax.activation.*;

public class TestMail
{
public static void main(String[] args)
{
try
{
String to = "nisha.barthwal@mivas.in";
String cc = "sampan.saini@mivas.in";
String bcc = "dharmesh.mahawar@mivas.in";
String from = "medha.vadi@mivas.in";
String subject = "Hi There...";
String text = "How are you?";

Properties properties = new Properties();
properties.put("mail.trasport.protocol","smtp");
properties.put("mail.smtp.host", "smtpout.secureserver.net");
properties.put("mail.smtp.port", "80");
properties.put("mail.smtp.auth","true");
//Session session = Session.getDefaultInstance(properties, null);
//Session session = Session.getInstance(properties,null);
Session session=Session.getInstance(properties, new MailAuthenticator());
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setRecipient(Message.RecipientType.CC, new InternetAddress(cc));
message.setRecipient(Message.RecipientType.BCC, new InternetAddress(bcc));
message.setSubject(subject);
message.setText(text);

Transport.send(message);
}


catch(MessagingException e)
{
System.out.println("Exception found @ e"+e);
}
catch(IllegalStateException ex)
{
System.out.println("Exception found @ ex"+ex);
}
}//end of main

}//end of class TestMail

class MailAuthenticator extends Authenticator {

public MailAuthenticator() {
}

public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("medha.vadi@mivas.in", "password");
}
}


For this you have to keep 2 jar files inside your jdk/jre/lib/ext and jre6/lib/ext folder
1st jar file is activation.jar file and 2nd file is mail.jar. You can download these jar files from www.findjar.com and www.java2s.com.



Now in JSP

<%@ page import="java.io.*,java.util.*,javax.mail.*"%>
<%@ page import="javax.mail.internet.*,javax.activation.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@page import="javax.mail.Authenticator"%>
<%@page import="javax.mail.PasswordAuthentication"%>

<%
String result;

try
{
String host = "smtpout.secureserver.net";
String to="sampan.saini@mivas.in";
String from = "helpdesk@mivas.in";
// String cc = "nisha.barthwal@mivas.in";
String pass = "pass";
Properties props = System.getProperties();
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", host);
props.put("mail.smtp.user", from);
//props.put("mail.smtp.password", pass);
props.put("mail.smtp.port", "80");
props.put("mail.smtp.auth", "true");

Session session1 = Session.getInstance(props, new Authenticator()
{
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("sampan.saini@mivas.in","omsairam");
}
});
MimeMessage message = new MimeMessage(session1);
Address fromAddress = new InternetAddress(from);
Address toAddress = new InternetAddress(to);
// Address ccAddress = new InternetAddress(cc);

message.setFrom(fromAddress);
message.setRecipient(Message.RecipientType.TO, toAddress);
//message.setRecipient(Message.RecipientType.CC, ccAddress);

message.setSubject("Tech Support");
message.setText("Hi,\n Please Give the solution of problem ID: ");
Transport transport = session1.getTransport("smtp");
transport.connect(host, from, pass);
message.saveChanges();
Transport.send(message);
out.println("------Your Mail Sent Successfully-----");
transport.close();

}
catch(Exception ex)
{

out.println("");
out.println("ERROR: " + ex);
out.println("");
}
%>