6/23/10

Java Speech Api

import java.beans.PropertyVetoException;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Locale;

import javax.speech.AudioException;
import javax.speech.Central;
import javax.speech.EngineException;
import javax.speech.EngineStateError;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
import javax.speech.synthesis.Voice;

public class SpeechUtils {

SynthesizerModeDesc desc;
Synthesizer synthesizer;
Voice voice;


public void init(String voiceName)
throws EngineException, AudioException, EngineStateError,
PropertyVetoException
{
if (desc == null) {

System.setProperty("freetts.voices",
"com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");

desc = new SynthesizerModeDesc(Locale.US);
Central.registerEngineCentral
("com.sun.speech.freetts.jsapi.FreeTTSEngineCentral");
synthesizer = Central.createSynthesizer(desc);
synthesizer.allocate();
synthesizer.resume();
SynthesizerModeDesc smd =
(SynthesizerModeDesc)synthesizer.getEngineModeDesc();
Voice[] voices = smd.getVoices();
Voice voice = null;
for(int i = 0; i < voices.length; i++) {
if(voices[i].getName().equals(voiceName)) {
voice = voices[i];
break;
}
}
synthesizer.getSynthesizerProperties().setVoice(voice);
}

}

public void terminate() throws EngineException, EngineStateError {
synthesizer.deallocate();
}

public void doSpeak(String speakText)
throws EngineException, AudioException, IllegalArgumentException,
InterruptedException
{
synthesizer.speakPlainText(speakText, null);
synthesizer.waitEngineState(Synthesizer.QUEUE_EMPTY);

}


public static void main (String[]args) throws Exception{
SpeechUtils su = new SpeechUtils();

su.init("kevin16");
// high quality
su.doSpeak("pardesi muje tu loot lia");
su.terminate();
}
}


you have to download fp2006-final-3.00-setup ... search google or sourceforge

extract jsapi from lib/jsapi.exe
then add all the jars to your project

1/24/10

How to unlock Soctt account in oracle10g if sys password is unknown

c:> sqlplus /nolog -------------------------your sqlplus installation directory
SQL> connect / as sysdba
SQL> SHO USER
USER is "SYS"
SQL> ALTER USER sys IDENTIFIED BY ora10g;------ this is your sys pwd

SQL> ALTER USER scott IDENTIFIED BY tiger account unlock;


now open sql+ using scott tiger.

1/2/10

To dissable internet connection using cmd

netsh interface ip show config

to view



netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1

to modify

Send Mail using JAVA MAIL API

You need mail.jar to add your project

==========================

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package gmail;

/**
*
* @author kronos
*/
import javax.mail.*;
import javax.mail.internet.*;

import java.util.Properties;


public class SimpleSSLMail {

private static final String SMTP_HOST_NAME = "smtp.gmail.com";
private static final int SMTP_HOST_PORT = 465;
private static final String SMTP_AUTH_USER = "kronosinhaven@gmail.com";
private static final String SMTP_AUTH_PWD = "cloudnumber9";

public static void main(String[] args) throws Exception{
new SimpleSSLMail().test();
}

public void test() throws Exception{
Properties props = new Properties();

props.put("mail.transport.protocol", "smtps");
props.put("mail.smtps.host", SMTP_HOST_NAME);
props.put("mail.smtps.auth", "true");
// props.put("mail.smtps.quitwait", "false");

Session mailSession = Session.getDefaultInstance(props);
mailSession.setDebug(true);
Transport transport = mailSession.getTransport();

MimeMessage message = new MimeMessage(mailSession);
message.setSubject("shutdown");
message.setContent("shutdown", "text/plain");

message.addRecipient(Message.RecipientType.TO,
new InternetAddress("kronosinhavens@gmail.com"));

transport.connect
(SMTP_HOST_NAME, SMTP_HOST_PORT, SMTP_AUTH_USER, SMTP_AUTH_PWD);

transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
transport.close();
}
}