|
English is the main language supported and if you want to add another this is what the website mentions:
How do I add support for a language other than English?
This is not a trivial task as it requires a lexicon for the language as well as various statistical data about the language. The document http://festvox.org/festvox/festvox_toc.html describes this is more detail.
from: http://freetts.sourceforge.net/docs/index.php#How_do_I_add_support_for_a_voice_with[^]
Regards
|
|
|
|
|
I have a code I've been working on in JCreator for school and i can't seem to get it right. Will somebody please help me with this and tell me what I am doing wrong?
/* Author: Dale Leach
* Date: 9/15/09
* File: Goods Hands Program
* Desc: To find out if an auto is insurable.
*/
import java.io.*;
public class goodHands
{
// declare global scope variables
private BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
private String inputString;
public goodHands()throws IOException //I-O-P
{
initialize();
insureProcess();
cleanUp();
}//end constuctor
public void initialize()
{
System.out.println();
System.out.println("Welcome to the Goods Hands Program.");
System.out.println();
}// end initialize
public void insureProcess() throws IOException
// declare local variable for car choice
{
String carChoice;
boolean insurable = false;
int carYear;
boolean year = false;
System.out.println ("Please enter a car model: ");
inputString = input.readLine();
carChoice = inputString;
// Check Model for insurability
insurable = checkModel(carChoice);
// Check Year for insurability
System.out.println("Please enter year of car: ");
carYear = Integer.parseInt (input.readLine());
year = checkYear (carYear);
printResults(year);
// Print results based on insurability
}// end insureProcess
public boolean checkModel(String carChoice)
{ boolean insurable = false;
if (carChoice==("Ford") carChoice==("Chevy") carChoice.==("Toyota"))
insurable = true;
return insurable;
}// end checkModel
public boolean checkYear(int year)
{
boolean year = false;
if(carYear = 1990) year = true;
return year;
}// end checkYear
public void printResults(boolean insurable)
{
if (insurable);
System.out.println("Car is insurable.");
else
System.out.println("Sorry your car is not insurable.");
}// end printResults
public void cleanup()
{
System.out.println();
System.out.println("The Good Hands Program is complete.");
System.out.println("Have a nice day.");
}// end cleanup
public static void main(String [] args) throws IOException // main method
{
new goodHands();
} // end the main method
} // end the program
|
|
|
|
|
Use either Eclipse or Netbeans the latter IDEs show you exactly where your errors are:
1. The constructor of a class has the same name as the class (Line 17).
2. In line 61 you have a typo error in your third equality plus what are you doing with your equalities i.e. what are you using in between them is it an and or an or....
3. In line 69 the same variable cant have many data type.
4. In line 71 the variable your using in the method is hidden from that method so define in it outside the method as either public,protected,private and since your using it in a static method also static.
5. In line 81 to 83 you have a typo error. In line 81 remove the semi colon from the if statement.
Good luck
|
|
|
|
|
My advice would be to ask your teacher. Most teachers won't mind if you ask a sensible question, they don't think it's stupid, they think it shows interest in the subject and they should be happy to help. After all, they are there to teach you (in theory at least).
From a quick glance at the code you have posted above, this line does not look right:
if (carChoice==("Ford") carChoice==("Chevy") carChoice.==("Toyota"))
Neither does this line:
if (insurable);
I probably wouldn't do all the work in the constructor, either. If I say much more than that, I'll be doing your homework for you, which I am not going to do.
|
|
|
|
|
Looking for reading Material on Concurrent Programming in Java. Im trying to understand Pthreads and semaphore
|
|
|
|
|
|
|
i want to implement text to speech converter in java. how to do that? can i do it using core java or do i need advanced java to implement it?
i m having it as a final year project.
|
|
|
|
|
start making a concept - most times this helps me a lot.
"text to speech" means you want to convert written text into audio? What kind of text? You will need a person with a clear, smart voice (probably a woman).
greets
Torsten
I never finish anyth...
|
|
|
|
|
|
Hey guys! So I've been trying to get this utility method to work for a while and can't seem to stop overloading the stack. The method should be able to emulate the Paint Can Tool in MS Paint. It takes a BufferedImage, the x- and y-coordinates of the point to apply the method to, and the color with which to paint the area. My implementation is a recursive one, and I know this is the reason for the overflow, but I haven't done any complex recursive method writing as of yet and don't know how I can fix my problem. Here is the code I've written:
static void paintCan(BufferedImage image, int x, int y, Color color) {
int[][] array = new int[image.getWidth()][image.getHeight()];
for (int r = 0; r < image.getHeight(); r++)
for (int c = 0; c < image.getWidth(); c++)
array[c][r] = image.getRGB(c, r);
changeColor(array, x, y, array[x][y], color.getRGB());
for (int r = 0; r < image.getHeight(); r++)
for (int c = 0; c < image.getWidth(); c++)
image.setRGB(c, r, array[c][r]);
}
static void changeColor(int[][] image, int x, int y, int from, int to) {
if (image[x][y] == from) {
image[x][y] = to;
int left = x - 1;
int right = x + 1;
int up = y - 1;
int down= y + 1;
if (left >= 0)
changeColor(image, left, y, from, to);
if (right < image.length)
changeColor(image, right, y, from, to);
if (up >= 0)
changeColor(image, x, up, from, to);
if (down < image[0].length)
changeColor(image, x, down, from, to);
}
}
This method works perfectly for smaller areas, but when the area selected at the (x, y) point requires too much recursion, a runtime error is thrown. Does anyone know how I can get the method to use less memory and not overload the stack? Help is very appreciated Thank you!
-max
|
|
|
|
|
I did some testing with your code and here are my results:
1. Image size does not effect result.
2. The Pixels in your image cause the stack overflow.
- When your image is mono colored.
- When your image contain n colors in shapes lets say black square, green circle etc...
The above throw the Exception
- When approximately all pixels of the image vary then your code works fine with any size even with 1920 x 1080.
If you want to use the bucket feature in MS Paint here is a simpler way:
BufferedImage image = ImageIO.read(new File("Desert.jpg"));
Color c = Color.red;
int x0 = 10,x1 = 100,y0 = 10,y1 = 100;
for (int i = x0; i < x1; i++)
{
for (int j = y0; j < y1; j++)
{
image.setRGB(i, j, c.getRGB());
}
}
ImageIO.write(image, "jpg", new File("Result.jpg"));
By the way the recursion problem is in the change color method.
Hope this help
|
|
|
|
|
I was aware that it was not the image size, but the number of pixels in the shape being filled that was the problem, and that the recursion overflow error was occurring in the changeColor() method... Your solution does not implement the bucket feature in MS Paint, because when you use the paint bucket in Paint it fills all adjacent pixels of a similar color with the color of your choice, what you have given me only fills a rectangle with a certain color :/
Thanks for the reply though!
|
|
|
|
|
I think I found the answer guys. My main problem for looking for help with my problem was that I didn't know what the "paint can tool" functionality was called! But it turns out there is something called the Flood Fill Algorithm that is exactly what I'm talking about implementing.
http://en.wikipedia.org/wiki/Flood_fill[^]
|
|
|
|
|
My bad, in my way I was trying to say that if you give the coordinates of the pixels then use the graphics class to fill in the color but its not practical any way here is a nice implementation of the specified algorithm: http://www.cis.upenn.edu/~matuszek/cit594-2005/ Check FloodFillApplet.java and ColorArrayComponent.java
Good luck
|
|
|
|
|
|
how to devlop TAPI in java. i want to devlop TAPI in java and use this interface in ASP.Net application to devlop a virtual phone.
|
|
|
|
|
I personally haven't done Tapi programming but from what I searched you can do it solely using ASP.NET
http://www.julmar.com/blog/mark/PermaLink,guid,0535ed97-f590-438e-9b99-1ddee1e8237a.aspx (you require the Atapi.dll from http://www.julmar.com/tapi/)
I also found this (JTapi) http://xtapi.sourceforge.net/ and http://blog.devrealm.org/2009/03/26/jtapi-overview/ You can convert the classes to applets and embed them in your ASP.NET application but I think if you can get the first link to work that would save you a lot of time.
Good Luck
|
|
|
|
|
Hi all,
am an entirely a newbie in encryption, just decided to give it a go with a book. But a lost at trying to configure my machine to run simple encryption codes, like the one given below; running with a 128-byte array size works fine but i dont know how i can implement the 256-byte or 192-byte array key size.
I've replaced the "strong Encryption" policy in JRE in Java path with unrestricted policy jar files i downloaded from Sun website.
Also i used the bounty Castle provider and copied the jar files to "ext" sub-directory in Jre directories.
Yet it does'nt seem to work perfectly.
Any Idea would be greatly appreciated.
Thanks alot in advance!!
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
public class EncryptTest {
public EncryptTest()
{
}
public static void main(String[] args) throws Exception
{
KeyGenerator keygen = KeyGenerator.getInstance("AES");
keygen.init(192);
SecretKey aesKey = keygen.generateKey();
Cipher aesCipher;
aesCipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
aesCipher.init(Cipher.ENCRYPT_MODE, aesKey);
byte[] clearText = "This is an example!".getBytes();
System.out.println("ClearText: "+new String(clearText));
byte[] cipherText = aesCipher.doFinal(clearText);
System.out.println("CipherText: "+new String(cipherText));
aesCipher.init(Cipher.DECRYPT_MODE, aesKey);
byte[] clearTextDecrypt = aesCipher.doFinal(cipherText);
System.out.println("DecryptedText: " + new String(clearTextDecrypt));
boolean equalText = Arrays.equals(clearText, clearTextDecrypt);
if (equalText)
{
System.out.println("Successful recovery!");
}
else
{
System.out.println("String was NOT recovered!!");
}
}
}
|
|
|
|
|
Your code will run fine but you need to tweek your JDk and JRE.
1. Go to http://java.sun.com/javase/downloads/index.jsp and download Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6.
2. In these directories C:\Program Files\Java\jdk1.6.0_16\jre\lib\security and C:\Program Files\Java\jre6\lib\security
3. Paste the two jars you downloaded and everything will work.
Regards
|
|
|
|
|
Thanks Member 4277480 for ur reply, but i did the same with jdk1.5_20 and did exactly what u said, but it isn't working for me.
Any other thing I should do?
Thanks again!!
|
|
|
|
|
Upgrade to 6u16! Always use latest JDK.
|
|
|
|
|
I will try just that and then c how it works.
I will give u a feed back later!
Thanks!
|
|
|
|
|
Thanks a lot Member, ur advice worked perfectly!
I'll now enjoy enciphering and deciphering I guess!!!
Thanks!
|
|
|
|
|
Good to hear your progress
|
|
|
|