|
I need your help in java.
1)how to convert audio file into binary format in java.
2)Then that Binary converted audio file is to be matched in SQLServer 2005 Database .Which i have stored it in varBinary(MAX) format.
3)I want to match both files during authentication.
thank You!
|
|
|
|
|
Nileshbhoi wrote: how to convert audio file into binary format in java.
It's already in binary format. Maybe that is not really what you are asking for, please clarify.
|
|
|
|
|
And you really expect that when one man speaks a short sentence two times, all thousands of bytes will be exactly the same? Also the background noise will be same...
No, that will work not at all. Learn some basics about audio information, analysing audio, searching for similarities between audio data, etc.
|
|
|
|
|
|
how to save the text file to any directory...and suggest any new algorithm for encoding and decoding or explain discret markvo chain model
|
|
|
|
|
Basavaraj Neelagund wrote: explain discret markvo chain model
I chose the more difficult question first which can be explained here[^].
For the simple question you could try here[^].
|
|
|
|
|
Have you tried anything so far? If so show us here, we can comment on it if you have stuck on something.
If you've never failed... You've never lived...
|
|
|
|
|
hello
in my java program I excecute a command through the code => it works
but as I stepped into the prog : I found myself with a command that requires an answer after his execution
then by java program: I do not know how to answer but in the command line I responds with yes and it works
do you have any idea how to respond through the java code
I hope you understand the question:
Here's the code I use for execute command DOS :
public static String importer_certificat(String alias,String nom_certi,String nom_keystore,String pass_keystore)
{
try{
String b = "keytool -import -alias "+alias+" -file "+nom_certi+" -keystore "+nom_keystore +" -storepass "+pass_keystore;
System.out.println(b);
Process p = Runtime.getRuntime().exec(b);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String inputLine, tous = "";
while ((inputLine = in.readLine()) != null)
{
tous += "\n"+inputLine;
System.out.println(inputLine);
}
return tous;
}catch(Exception e)
{
e.printStackTrace();
return e.getMessage();
}
}
thank you in advance
|
|
|
|
|
|
The OP is asking how to make the java code respond to a query from the process.
waitFor() isn't going to help with that.
|
|
|
|
|
ahmadiss wrote: (p.getInputStream()))
That gets what the normal application 'output'.
Now you need to send it 'input'.
So you use getOutputStream()
Also keep in mind that your solution will only work if the application outputs a very, very little amount of text. If it outputs large amounts then you will need to use threads for the IO and perhaps use waitFor().
|
|
|
|
|
how to convert a java file into a stand alone file
|
|
|
|
|
Your question is not clear, a Java file is already stand alone. Please try and explain what problem you are trying to solve.
|
|
|
|
|
I suspect OP means a standalone exe.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Me too; I'm just trying to get him/her to think about what they are asking.
|
|
|
|
|
As Richard said, please reword your question. Are you trying to make a java .class file be a standalone executable?
Creating an Executable jar File[^] might be of interest to you
""Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hello
I want to create a program that signs and verifing file with jarsigner
I succed to create .jar but the keystore not
here is my code :
public static void main(String[] args)
{
try
{
String[] dd = { "cmd.exe", "/C", "dir C:\\ >keytool-genkey-alias-keystore signLegal examplestanstore.jks" };
Process p = Runtime.getRuntime().exec(dd);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) System.out.println(inputLine);
}catch(Exception e)
{
e.printStackTrace();
}
}
in netbeens it write me BUILD SUCCESSFUL (total time: 1 second) but don't create the fiel of keystores
my goal is to create that with program
do you have any idea
thank you in advance
|
|
|
|
|
ahmadiss wrote: in netbeens it write me BUILD SUCCESSFUL
So you have built your program, but you still need to run it in the JVM.
|
|
|
|
|
first thank you for your reply
how to execute it in the jvm ?
I can't run it only with program !!
|
|
|
|
|
|
Well, my French is not very good but it looks like the message says "keytool-genkey-alias-keystore is not recognised as a command or program file name". I suggest you check where this program resides and use the full pathname to run it.
|
|
|
|
|
thank you , I resolved the problem : problem in path
|
|
|
|
|
this is my code. what wrong with my code? i want to save the image on the canvas as a png picture.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.colorchooser.*;
import javax.swing.event.*;
import java.awt.geom.Line2D;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import javax.imageio.ImageIO;
public class PaintIt extends JFrame implements ActionListener{
public BufferedImage image = new BufferedImage(500, 500, BufferedImage.TYPE_INT_RGB);
JPanel buttonPanel = new JPanel();
Point lastPos = null;
Point startPos = null;
Point finishPos = null;
Graphics g;
JButton save = new JButton("Save");
JButton cancel = new JButton("Cancel");
JButton clear = new JButton("Clear");
JButton proceed = new JButton("Proceed");
JPanel canvas = new JPanel();
int changer = 1;
String path="";
public PaintIt () {
setLocation(100,100);
setSize(600,500);
setTitle("ENCODE SECTION");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
canvas.setBackground(Color.WHITE);
clear.addActionListener(this);
clear.setActionCommand("clear");
save.addActionListener(this);
save.setActionCommand("Save");
cancel.addActionListener(this);
cancel.setActionCommand("Cancel");
proceed.addActionListener(this);
proceed.setActionCommand("Proceed");
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPanel.add(Box.createHorizontalGlue());
buttonPanel.add(save);
buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPanel.add(clear);
buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPanel.add(cancel);
buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPanel.add(proceed);
getContentPane().add(canvas, BorderLayout.CENTER);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
setVisible(true);
g = canvas.getGraphics();
g.setColor(Color.BLACK);
canvas.addMouseMotionListener(new MouseMotionListener () {
public void mouseDragged (MouseEvent m) {
Point p = m.getPoint() ;
if (changer==1){
g.drawLine(lastPos.x, lastPos.y, p.x, p.y) ;
}
lastPos = p ;
}
public void mouseMoved (MouseEvent m) {}
});
canvas.addMouseListener(new MouseListener () {
public void mouseClicked(MouseEvent e) {startPos = e.getPoint();}
public void mousePressed(MouseEvent e) {lastPos = e.getPoint();}
public void mouseReleased(MouseEvent e) {
lastPos = null;
finishPos = e.getPoint();
startPos = null;}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
});
}
public void actionPerformed(ActionEvent e) {
if("clear".equals(e.getActionCommand())) {
repaint();
}
if("Save".equals(e.getActionCommand())) {
new captureCanvasImage();
}
if("Cancel".equals(e.getActionCommand())) {
dispose();
}
if("Proceed".equals(e.getActionCommand())) {
new encode1Pane();
}
}
class captureCanvasImage {
public void capture(){
Graphics g = image.createGraphics();
canvas.paint(g);
int w = canvas.getWidth();
int h = canvas.getHeight();
BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
g.dispose();
try
{
ImageIO.write(image, "jpg", new File("panel.jpg"));
}
catch(IOException ioe)
{
System.out.println("Panel write help: " + ioe.getMessage());
}
}}
public static void main (String [] args) {
PaintIt p = new PaintIt();
p.setVisible(true);
}
}
|
|
|
|
|
Are you invoking the capture method in your captureCanvasImage class?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
capture method? sorry i'm new to java. can you help me?
|
|
|
|