conor murphy

Greenhorn
+ Follow
since May 06, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by conor murphy

hi

does anyone know of a command line ripper that works in windows. i am trying to find one to use in my java program. or is there a java library that has ripping functions? i need to be able to run it in windows

thanks
14 years ago
hi

i have created a program that uses the runtime.exec()method to run an external program. my problem is that when i run the program, it does nothing until i press cntrl-c to break it and then it prints out the output from the external program. is there a way to run the external program while my program is running without having to wait until my program ends? do i need to use threads?

thanks
14 years ago
hi

i was wondering if anyone new how to rip cds into mp3s in java or any good tutorials that explain how to rip tracks from a cd and convert them into mp3s

thanks
14 years ago
hi

i was wondering if anyone has any sample code for playing an Mp3 file in java. do you need a specific library?. also does anyone know of any good tutorials on how to play mp3 files.

thanks
14 years ago
hi

i am trying to write a peer to peer chat program. i have created a server client program that works fine but when it comes to the peer to peer program i am have a problem. i cannot find a way to connect the two clients together without having to make one use a ServerSocket so that the other one can connect to it. is there a way to just have each client with a Socket and have them connect that way or do i need to make one use a ServerSocket?

thanks
hi

i have a client server program. i can send and recieve text fine. i am trying to create a function that is able to send an image object. i create and objectoutputstream and it sends it properly however when the server recieves it,it prints out a lot of garbage which i thikn is the object. i dont want it to print out the object though. it kind of hard to explain. is there anyway to distinguish between an input stream reader and an object input stream reader so that it knows wen to print out text but not image objects?

thanks

here is a piece of the code i have. it creates a buffered input stream reader and also an object inputstream reader

in = new BufferedReader(new InputStreamReader(sock.getInputStream()));

ObjectInputStream obj = new ObjectInputStream(sock.getInputStream());

src= (PlanarImage)obj.readObject();
15 years ago
hi

i have a client and a server program and i am trying to make multiple clients connect to one server. i create a new server thread each time a client connects. when i run the program, i can open up a single client and send a message to the server. but when i open up a new client and connect, the new client can send a message to the server but the first client doesnt send it anymore. could someone please tell me what im doing wrong.

thanks

ps. i took most of the code out to make it smaller. i think the problem is somewhere in this code but i cant find it.


class Client {


public static Socket sock;

public static BufferedReader in;
public static PrintWriter out;


public Client() {

}


public static Socket connect() {


try {

Socket skt = new Socket("localhost", 12345);

return skt;
}
catch(Exception e) {
System.out.print("Connection Failed!\n");
return null;
}

}

public static void sendMessage() {

out.println(msgBox.getText())//this is a textbox that i have;
out.flush();



}


/** main class that initiate and starts the application */
public static void main(String[] args){

String s;

while(true)
{


try{

sock = connect();

}

catch (IOException e) {
System.out.println("Connection Failed");
}




}


}//main
}


class Server {


public static boolean listening = true;

public static Socket sock;

public static BufferedReader in;
public static PrintWriter out;



public Server() {
//initiate the inteface


}

public static void main(String[] args) throws IOException{

ServerSocket server = null;
String s;

try {

server = new ServerSocket(12345);
}

catch (IOException e) {
System.out.println("Connection Failed");
}

while(listening)
{

new ServerThread(server.accept()).start();

}

server.close();
}//main
}


public class ServerThread extends Thread {

private static Socket sock = null;

public ServerThread(Socket socket) {

this.sock = socket;


}

public void run() {

String s;

while(true)
{
try{

BufferedReader in = new BufferedReader(new InputStreamReader(sock.getInputStream()));

PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(sock.getOutputStream())), true);

s="";

if (in.ready())
{

s = in.readLine();

if ((s != null) && (s.length() != 0))
{
System.out.println("Recieved from: "+ s+"\n");

}
}

}

catch (IOException e) {
System.out.println("Connection Failed");
}

}


}
}
hi

i am trying to write a program that breaks up a video file into individual frames and then manipulate each frame by compositing a jpeg image into it. i have some sample source code from this website

http://java.sun.com/products/java-edia/jmf/2.1.1/solutions/FrameAccess.html

this creates a new componenet and places the visual component from a processor into it.

Component vc;
if ((vc = p.getVisualComponent()) != null) {
...
im not quite sure exactly how all this works because im new to it. am i able to somehow create a PlanarImage of each frame using the component so i can manipulate it with code that ive already written and then put all the frames back together again. ive read the tutorials on the jmf site but im still struggling with it

any help would be great

thanks
15 years ago
hi

i am trying to make a program which has a server and a multiple clients. i create a new thread each time a client connects to the server. how can i get the server to recieve some data from one client and then pass it on to another client. should i create new threads of servers each time i accept a connection or just have one main server?. im dont have that much knowledge about threads and find them quite difficult. does anyone know of a good site that has an example of what im trying to do

thanks
hi

i am wanting to write a program that connects to a webpage that my brother has made. i want to make it kind of like the ebay program that retrieves how long is left in the auction and other details that would be stored in a database. is there a way to do this? am i in the right forum to be askign this question?

thanks
ive got to use the JAI library for an assignment at uni. they told us we are not allowed to use anything else excpet the JAI library. i found a way to do it using lookups but i dont really understand how it works so i dont want to use it if i cant tell what it does

here is the code anyway. maybe someone has seen this code before and can explain what is happening

// Brightness processor
public void processBrightContrast(int ipParam, Image pImage){

Image mImage = pImage;
//Create parameter block
ParameterBlock mPB = new ParameterBlock();
//Add image source to parameter block
mPB.addSource(mImage );

byte lutData[];
lutData = new byte[256];
for(int j = 0; j < 256; j++)
lutData[j] = clampByte(j + ipParam);

LookupTableJAI mLookup = new LookupTableJAI(lutData);

mPB.add(mLookup );
RenderedOp mRenOp;

// Process the brightness/ darkness
mRenOp= JAI.create("lookup", mPB, null);
return mRenOp.getAsBufferedImage();
}


private final byte clampByte(int i)
{
if(i > 255)
return -1;
if(i < 0)
return 0;
else
return (byte)i;
}

thanks
15 years ago
hi

i have a program called JAI tutor. it is a tutorial on how to use the JAI api and it uses ImageDisplay. i havent been able to find anything on it though.
15 years ago
hi

i have an image stored in an ImageIcon. i am trying to set the brightness using a slider. i have found a few tutorials that use the setBrightness function but this is used on an ImageDisplay object. is there anyway to get a setBrightness function on the ImageIcon or anyway to convert the ImageIcon into an ImageDisplay and then set the brightness and convert it back to an ImageIcon.

thanks
15 years ago
hi

thanks for that its working now

thanks
15 years ago
hi

i am trying to save an image that i have in a JLabel as a jpeg file. i am able to load the image as an ImageIcon and then add it to a label but when i try to save it using ImageIO.write() it just turns the whole thing black. would someone please be able to tell me wat im doing wrong.

thanks

try{

//open file dialog box
Frame frame = new Frame();
FileDialog fd = new FileDialog(frame, "Save File", FileDialog.SAVE);
fd.show();

//retirve the path
path = fd.getDirectory();

//retrieve the filename
filename = fd.getFile();

//add the filename and path together
filename = path + filename;

BufferedImage bi = new BufferedImage(im.getIconWidth(),im.getIconHeight(),BufferedImage.TYPE_INT_RGB);

ImageIO.write((RenderedImage)bi, "jpeg", new File(filename));

}
catch(IOException e) {
// Print out the exception that occurred
System.out.println("Unable to Save");
}


}
15 years ago