Problem with creating JAVA Source. please help
Dear all
how are you.
In fact I have made a simple java class that return a string which represents the screen size . for example 800/600 or 1024/768 or others
but I face error ORA-29541 class string.string could not be resolved
This what i made
first i created my JAVA Source
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ScreenProperty" AS
import java.lang.Object;
import java.awt.*;
public class ScreenProperty
int w;
int h;
public static String getScreenSize()
w = Toolkit.getDefaultToolkit().getScreenSize().width;
h = Toolkit.getDefaultToolkit().getScreenSize().height;
return w+"/"+h;
SQL>Operation 160 succeeded.
this means the the java source created successfuly
and I'm sure that my java code is correct
then i created a fuction to call this java source as fellow
SQL> create or replace function f_get_screen_size
return varchar2
as language java
name 'ScreenProperty.getScreenSize() return java.lang.String';
Function created.
the I Issued this sql statement to return the result that should be varchar2 that represent the sceen size(1024/768)
SQL> select f_get_screen_size from dual;
ORA-29541 class string.string could not be resolved.
I do not know what is the reason for this error
and when i searched the documentation for this error i found
ORA-29541 class string.string could not be resolved
Cause: An attempt was made to execute a method in a Java class that had not been previously and cannot now be compiled or resolved successfully.
Action: Adjust the call or make the class resolvable
I need to know what is the problem.
And is there another way to load this class other than making JAVA SOURCE
please help
before drawing hands of clock you could fill a circle/oval with certain color, then you'd have that kind of circle that has been filled as backgound.
you may change those dots to be small lines for 12, 3, 6 and 6 o'clock and then have small dots represent 1, 2, 4, 5, 7, 8, 10 and 11 o'clock
anyhow, you should study that code and see how you can modify it whitout breaking it but having it look different.
better yet would be trying to understand how it works, what any line there means and then recreate your own... this way you would learn more....
and if there are some methods or anything you don't understand, then look them up from API documentation
good luck.
Similar Messages
-
Firefox is having problems with "Southwest Airlines website" Please help soon
Whenever I go on Southwest Airline website, it does not work. I am having this problem since last month. Please help on this as soon as you can.
Clear the cache and the cookies from sites that cause problems.
* "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
* "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"
Other things that need your attention:
Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
* Shockwave Flash 10.0 r22
* Java Plug-in 1.6.0_07 for Netscape Navigator (DLL Helper)
Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
*http://kb.mozillazine.org/Flash
*http://www.adobe.com/software/flash/about/
Update the [[Java]] plugin to the latest version.
*http://kb.mozillazine.org/Java
*http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE) -
Problem with my code!Please help:(
Hi
Here is the final code to read each byte at a time (using buffered input stream)from a remote sensed image and then store the values in 3 arrays . The image data (it is a remote-sensed image with 3 bands) are represented as a continuous byte stream band sequential. The format of the header is as follows:
Bands (int)
Rows (int)
Cols (int)
Bits-per-pixel (int)
and then the image data follow.
the code is:
import java.io.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.Panel.*;
import java.util.*;
import java.awt.image.MemoryImageSource.*;
public class Reader {
public static void main (String args []){
int numBands;
int rows;
int cols;
int bpp;
byte[] band1;
byte[] band2;
byte[] band3;
try {
FileInputStream fis = new FileInputStream ("BROM3.mar");
BufferedInputStream bis = new BufferedInputStream (fis);
DataInputStream dis = new DataInputStream (bis);
numBands = dis.readInt();
rows = dis.readInt();
cols = dis.readInt();
bpp = dis.readInt();
if((dis.readByte() !='.') ||
(dis.readByte() !='\r') ||
(dis.readByte() !='.'))
throw new Exception ("Bad format: end-of-header expected !");
int nBytes = rows*cols*bpp/8;
band1 = new byte[nBytes];
band2 = new byte[nBytes];
band3 = new byte[nBytes];
for (int j=0; j<nBytes; j++) {
band1[j] = dis.readByte();
for (int j=0; j<nBytes; j++) {
band2[j] = dis.readByte();
for (int j=0; j<nBytes; j++) {
band3[j] = dis.readByte();
} catch (Exception e) {
e.printStackTrace();}
* Creates three objects of the ImagePanel class
* and sets the size of both.
ImagePanel panel1 = new ImagePanel() ;
ImagePanel panel2 = new ImagePanel() ;
ImagePanel panel3 = new ImagePanel() ;
panel1.setSize (512,512);
panel2.setSize (512,512);
panel3.setSize (512,512);
* Converts the 3 arrays into
* images using the MemoryImageSource class and the Panel's
* createImage method.
Image green = panel1.createImage(new MemoryImageSource(512,512,band1[],0,512));
Image blue = panel2.createImage(new MemoryImageSource(512,512,band2[],0,512));
Image nir = panel1.createImage(new MemoryImageSource(512,512,band3[],0,512));
* Displays the images.
panel1.setDisplayImage (green);
panel2.setDisplayImage (blue);
panel3.setDisplayImage (nir);
* Creates two Frame objects to display the panels in and
* sets the size of both.
Frame frame1 = new Frame ();
frame1.setSize (512,512) ;
frame1.add (panel1);
Frame frame2 = new Frame();
frame2.setSize (512,512);
frame2.add (panel2);
Frame frame3 = new Frame();
frame3.setSize (512,512);
frame3.add (panel3);
* Makes the panels and the frames visible
* and sets the location of the frames.
panel1.setVisible (true);
panel2.setVisible (true);
panel3.setVisible (true);
frame1.setVisible (true);
frame1.setLocation (100,100);
frame2.setVisible (true);
frame2.setLocation (512,100);
frame3.setVisible (true);
frame3.setLocation (1024,100);
} //End of main
there is a problem especially in the MemoryImageSource bit.Can you please help me?
Thank you very much
MariaIt usually helps to know what the problem is before trying to solve it. Perhaps you could tell us?
-
Problems with the Proxy Programme--Please help
Hi All,
I have written a simple proxy server in the form of a servlet. I changed the proxy config of my browser to connect to this servlet hosted on the default context(http://localhost:8080) of the Tomcat 5.0.25 . Well , this servlet internally connects to the proxy of the corporate LAN . The logic that I have applied is as follows. The servlet gets the request from the client (ie the browser in this case) , extracts the headers and contents from the request, sets them to a new request that it forms and finally send this new request to the proxy. When the proxy responds, the servlet collects the response headers and contents adn writes them in its response. To sum up , this servlet transparently carries the requests and responses between the client(browser) and the corporate LAN proxy. Now the problem is this. Let's say , now I am accessing http://www.google.com.The browser sends a request to my servlet with the following headers as they are extracted by my servlet.
ProxyServer:::>posting request
ProxyServer:::>headerValue::> headerName = accept : headerValue=*/*
ProxyServer:::>headerValue::> headerName = referer : headerValue=http://www.google.com/
ProxyServer:::>headerValue::> headerName = accept-language : headerValue=en-us
ProxyServer:::>headerValue::> headerName = proxy-connection : headerValue=Keep-Alive
ProxyServer:::>headerValue::> headerName = user-agent : headerValue=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; UB1.4_IE6.0_SP1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
ProxyServer:::>headerValue::> headerName = host : headerValue=www.google.com
ProxyServer:::>headerValue::> headerName = cookie : headerValue=PREF=ID=1be27c0a74f198ca:TM=1082058853:LM=1082058853:S=bu6ORrygzm8AUkm8
ProxyServer:::>postRequest
I set these headers into a new connection opened to the proxy and post a fresh request to the proxy,which, in turn responds with the following headers.
ProxyServer:::>posted request successfully
ProxyServer:::>writing response
ProxyServer:::>writeResponse-->headerName = Proxy-Connection : headerValue = [close]
ProxyServer:::>writeResponse-->headerName = Content-Length : headerValue = [257]
ProxyServer:::>writeResponse-->headerName = Date : headerValue = [Tue, 13 Jul 2004 14:01:40 GMT]
ProxyServer:::>writeResponse-->headerName = Content-Type : headerValue = [text/html]
ProxyServer:::>writeResponse-->headerName = Server : headerValue = [NetCache appliance (NetApp/5.5R2)]
ProxyServer:::>writeResponse-->headerName = Proxy-Authenticate : headerValue = [Basic realm="Charlotte - napxyclt2"]
ProxyServer:::>writeResponse-->headerName = null : headerValue = [HTTP/1.1 407 Proxy Authentication Required]
ProxyServer:::>writeResponse exiting
ProxyServer:::>wrote response successfully
I write these headers back to the client. According to what I was thinking, the client ie the browser would open a new dialog box asking for username/password owing to the presence of the "Proxy-Authenticate " header. But it does not happen that way. Rather the browser stops responsding and displays a blank page. Does anyone know why it happens this way? I am pasting the server prog below for everybody's reference.
package server.proxy;
//import all servlet related classes
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
import java.net.*;
import server.resources.*;
//My Proxy server --->Currently it is very simplea and relies on
//other proxy servers of an already connected network.
public class ProxyServer extends HttpServlet
//stores the resource bundle
private ServerResBundle resBundle = null;
//checks for the mode of operation
private boolean proxySet = false;
private String proxy = null;
//storing the original System out/err etc
private PrintStream sysOutOrig = null;
private PrintStream sysErrOrig = null;
private InputStream sysInOrig = null;
//initialise certain features that are required later
public void init() throws ServletException
try
//initialise the resource bundle
this.initResBundle();
System.out.println("ProxyServer:::>res bundle init");
//set the mode of operation
this.setMode();
System.out.println("ProxyServer:::>mode set");
//set the system out and err --System.setOut etc
this.setSystemOutErr();
System.out.println("ProxyServer:::>in/out/err set");
}//End try
catch(Exception e)
System.out.println("Exception in init..."+(e.getMessage()));
throw new ServletException(e);
}//Edn
catch(Throwable e)
System.out.println("Irrecoverable Error...");
throw new ServletException(e);
}//End
}//End init
//method to init the resource bundle;
private void initResBundle()
this.resBundle = ServerResBundle.getBundle();
}//End
//method to set the mode of the server--proxy or direct
private void setMode()
//read the target proxy property from the bundle and
//if it is set,take that URL
String temp = (String)(this.resBundle.getResource(ResKeys.PROXY_SERVER));
if ( (temp != null) && (temp.length() > 0) )
this.proxySet = true;
this.proxy = temp;
temp = null;
}//End
}//End
//method to set the system out and err etc
private void setSystemOutErr() throws Exception
//keep a copy of the original system out and error
this.sysOutOrig = System.out;
this.sysErrOrig = System.err;
try
//read the options adn if they are set, take the values directly
String newOutStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_OUT));
String newErrStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_ERR));
if ((newOutStr != null) && (newOutStr.length() > 0))
System.setOut(new PrintStream(new FileOutputStream(new File(newOutStr),true),true));
}//End if
if ((newErrStr != null) && (newErrStr.length() > 0))
System.setErr(new PrintStream(new FileOutputStream(new File(newErrStr),true),true));
}//End if
}//End
catch(Exception e)
//restore the stuff
System.setOut(this.sysOutOrig);
System.setErr(this.sysErrOrig);
}//End
}//End
//this is where the proxy functionalities will be embedded
public void service(HttpServletRequest req,HttpServletResponse resp)
throws ServletException,java.io.IOException
//conenction URL
URL target = null;
//conenction to the remote object
URLConnection targetConn = null;
//stores the OOS and the OIS
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
try
//check for the mode of operation
if (proxySet)
URLConnection objects go through two phases: first they are created, then they are connected.
After being created, and before being connected, various options can be specified
(e.g., doInput and UseCaches). After connecting, it is an error to try to set them.
Operations that depend on being connected, like getContentLength, will implicitly perform the connection,
if necessary.
//for the URL to the proxy
target=new URL(this.proxy);
//conenct to the proxy
targetConn = target.openConnection();
//set the details of the connectuon
targetConn.setDoInput(true);
targetConn.setDoOutput(true);
targetConn.setUseCaches(false);
// If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. If false, then no user interaction is allowed
targetConn.setAllowUserInteraction(true);
//connect to the remote object
// targetConn.connect();//call this only when all the request properties are set
System.out.println("ProxyServer:::>posting request");
//post the received request to the URL
this.postRequest(targetConn,req);
System.out.println("ProxyServer:::>posted request successfully");
System.out.println("ProxyServer:::>writing response");
//receive the response
//write the received response to the client
this.writeResponse(targetConn,resp);
System.out.println("ProxyServer:::>wrote response successfully");
}//End if
else
//currently this functionality is not supported
throw new ServletException(
(String)(this.resBundle.getResource(ResKeys.ERR_FUNC_NOTSUPPORTED)));
}//End
}//End try
catch(Exception e)
if(e instanceof ServletException)
throw (ServletException)e;
}//End
if (e instanceof IOException)
throw (IOException)e;
}//End
//wrap it up in ServletException
throw new ServletException(e);
}//End
}//End
//method to write the response back to the client
private void writeResponse(URLConnection targetConn,HttpServletResponse resp)
throws ServletException
//get all the header fields from the response connection and set them to the
//response of the servlet
Map headerFields = null;
Iterator headerFieldEntries = null;
Map.Entry header = null;
//stores the input stream to the conn
BufferedReader brConn = null;
//stores the writer to the response
PrintWriter prResp = null;
//checks if the proxy authentication needed or not
boolean proxyAuthReqd = false;
try
//juste ensuring that the proxy authentication is reset
proxyAuthReqd = false;
if( (targetConn != null) && (resp != null) )
//Returns an unmodifiable Map of the header fields.
//The Map keys are Strings that represent the response-header field names.
//Each Map value is an unmodifiable List of Strings that represents the corresponding
//field values
headerFields = targetConn.getHeaderFields();
//Returns a set view of the mappings contained in this map
Set temp = headerFields.entrySet();
//Returns an iterator over the elements in this set
headerFieldEntries = temp.iterator();
if (headerFieldEntries != null)
while (headerFieldEntries.hasNext())
Object tempHeader = headerFieldEntries.next();
if (tempHeader instanceof Map.Entry)
header = (Map.Entry)tempHeader;
Object headerName = header.getKey();
Object headerValue=header.getValue();
System.out.println("ProxyServer:::>writeResponse-->headerName = "+headerName+" : headerValue = "+headerValue);
//do not select the key-value pair if both the key adn the value are null
if ( ( headerName == null) && (headerValue == null) )
continue;
}//Enmd
if (headerValue != null)
List headerValList = null;
if (headerValue instanceof List)
headerValList = (List)headerValue;
}//End
if(headerValList != null)
for (int i=0;i<headerValList.size();i++)
Object headerValueStr = headerValList.get(i);
if (headerValueStr instanceof String)
//note that the header-key can not be null for addHeader
//I have made this temporary provision to make the programme work.
resp.addHeader(( (headerName==null)? ("null_header"+i) :(String)headerName),
(String)headerValueStr);
//check if the proxy authentication required or not
if (((String)headerValueStr).
indexOf(resp.SC_PROXY_AUTHENTICATION_REQUIRED+"") != -1)
System.out.println("ProxyServer:::>writeResponse-->proxy auth needed");
//proxy authentication is needed
proxyAuthReqd = true;
}//End
}//Ednd of
else if (headerValueStr == null)
resp.addHeader(( (headerName==null)? null :(String)headerName),
null);
}//End
}//End for
}//End if
}//End if
}//End
}//End while
}//End if
//get the writer to the client
prResp = resp.getWriter();
System.out.println("ProxyServer:::>writeResponse-->proxyAuthReqd="+proxyAuthReqd);
//juste test a simple header
System.out.println("Proxy-Authenticate = "+(resp.containsHeader("Proxy-Authenticate")));
//if the proxy asks you for authentication,pass on the same to the client
//from whom you have received the request.When this flag is true,the connection
//is closed by the remotehost adn hence any attempt to open in input steram
//results in an error ie IOException
if (!proxyAuthReqd)
//now get the content adn write it to the response too
brConn = new BufferedReader(new InputStreamReader(
targetConn.getInputStream()));
String tempStr = null;
while ((tempStr = brConn.readLine())!=null)
prResp.println(tempStr);
}//End while
//close the connections
brConn.close();
}//End if
else
prResp.println("Proxy Authentication needed...");
}//End
//close the streams
prResp.flush();
prResp.close();
}//End if
System.out.println("ProxyServer:::>writeResponse exiting\n");
}//End try
catch(Exception e)
throw new ServletException(e);
}//End
}//End
//method to post request to the internet
private void postRequest(URLConnection targetConn,HttpServletRequest req)
throws ServletException
//extract the header parameters and the body content from the incoming request
//and set them to the new connection
Enumeration reqHeaders = null;
//reads the incoming request's content
BufferedReader brReqRd = null;
PrintWriter prResWt = null;
//stores temp header names and values
String headerName = null;
String headerValue = null;
try
if( (targetConn != null) && (req != null) )
reqHeaders = req.getHeaderNames();
//extract a header adn set it to the new connection
while (reqHeaders.hasMoreElements())
headerName = (String)(reqHeaders.nextElement());
headerValue = req.getHeader(headerName);
targetConn.setRequestProperty(headerName,headerValue);
System.out.println("ProxyServer:::>headerValue::> headerName = "+headerName+" : headerValue="+headerValue);
}//End
System.out.println("ProxyServer:::>postRequest\n");
//establis the actual connection
//calling this method bfore the above loop results in IllegalStateException
targetConn.connect();
//NOTE : try reading from and writing into OIS and OOS respectively
//now read the contents and write them to the connection
// brReqRd = req.getReader(); //this hangs for some reason
brReqRd = new BufferedReader(new InputStreamReader(req.getInputStream()));
System.out.println("Got the reader..brReqRd = "+brReqRd);
if (brReqRd != null)
String temp = null;
//establish the printwriter
// prResWt = new PrintWriter(targetConn.getOutputStream(),true);
prResWt = new PrintWriter(targetConn.getOutputStream());
System.out.println("trying to read in a loop from brReqRd.. ready="+(brReqRd.ready()));
while( (brReqRd.ready()) && ((temp=brReqRd.readLine()) != null) )
System.out.println("In while::>temp = "+temp);
prResWt.println(temp);
}//Emd while
//close the streams adn go back
brReqRd.close();
prResWt.flush();
prResWt.close();
}//End
}//End outer if
System.out.println("ProxyServer:::>postRequest exiting\n");
}//End try
catch(Exception e)
throw new ServletException(e);
}//End
}//End
}//EndHi serlank ,
Thanks for your reply. Well , I initially I thought of not pasting the code,as it was too long. But I could not help it,as I thought I must show in code what I exactly meant. That's why I followed a description of my problem with the code. You could probably have copied the code and pasted it in one of your favourite editors to take a look at it. Did you,by any chance, try to read it on the browser? And as regards reposting the same message, I can say that I did it as I felt the subject was not quite appropriate in the first posting and I was not sure as to how I could delete/alter the posting. I am not asking for a code-fix,but some suggestions from some one who might ever have come across such a thing.Anyway, lemme know if you have any idea on it. Thanks... -
Problem with interputting accessframe example please help!!!
A use code bellow to access every frame in the movie :
import java.awt.*;
import javax.media.*;
import javax.media.control.TrackControl;
import javax.media.Format;
import javax.media.format.*;
import java.io.*;
import javax.imageio.*;
import javax.imageio.stream.*;
import java.awt.Color.*;
import java.awt.image.*;
import java.util.*;
import java.awt.image.*;
import javax.media.util.*;
import javax.swing.JFrame;
public class Film2ramki implements ControllerListener {
Processor p;
Object waitSync = new Object();
boolean stateTransitionOK = true;
public boolean alreadyPrnt = false;
public void zakoncz(){
p.stop();
p.close();
p.deallocate();
public boolean open(MediaLocator ml) {
try {
p = Manager.createProcessor(ml);
} catch (Exception e) {
System.err.println("Failed to create a processor from the given url: " + e);
return false;
p.addControllerListener(this);
// Put the Processor into configured state.
p.configure();
if (!waitForState(p.Configured)) {
System.err.println("Failed to configure the processor.");
return false;
// So I can use it as a player.
p.setContentDescriptor(null);
// Obtain the track controls.
TrackControl tc[] = p.getTrackControls();
if (tc == null) {
System.err.println("Failed to obtain track controls from the processor.");
return false;
// Search for the track control for the video track.
TrackControl videoTrack = null;
for (int i = 0; i < tc.length; i++) {
if (tc.getFormat() instanceof VideoFormat) {
videoTrack = tc[i];
break;
if (videoTrack == null) {
System.err.println("The input media does not contain a video track.");
return false;
System.err.println("Video format: " + videoTrack.getFormat());
// Instantiate and set the frame access codec to the data flow path.
try {
Codec codec[] = { new PreAccessCodec(),
new PostAccessCodec()};
videoTrack.setCodecChain(codec);
} catch (UnsupportedPlugInException e) {
System.err.println("The process does not support effects.");
// Realize the processor.
p.prefetch();
if (!waitForState(p.Prefetched)) {
System.err.println("Failed to realize the processor.");
return false;
p.start();
return true;
boolean waitForState(int state) {
synchronized (waitSync) {
try {
while (p.getState() != state && stateTransitionOK)
waitSync.wait();
} catch (Exception e) {}
return stateTransitionOK;
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent ||
evt instanceof RealizeCompleteEvent ||
evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
} else if (evt instanceof EndOfMediaEvent) {
p.stop();
p.close();
System.exit(0);
Film2ramki(){}
public void startnow (String plik) {
//this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
String url = "file:"+plik;
if (url.indexOf(":") < 0) {
prUsage();
System.exit(0);
MediaLocator ml;
if ((ml = new MediaLocator(url)) == null) {
System.err.println("Cannot build media locator from: " + url);
System.exit(0);
if (!open(ml))
System.exit(0);
static void prUsage() {
System.err.println("Usage: java Film2ramki <url>");
* Inner class.
* A pass-through codec to access to individual frames.
public class PreAccessCodec implements Codec {
* Callback to access individual video frames.
void accessFrame(Buffer frame) {
// For demo, we'll just print out the frame #, time &
// data length.
long t = (long)(frame.getTimeStamp()/10000000f);
System.err.println("Pre: frame #: " + frame.getSequenceNumber() +
", time: " + ((float)t)/100f +
", len: " + frame.getLength());
* The code for a pass through codec.
// We'll advertize as supporting all video formats.
protected Format supportedIns[] = new Format [] {
new VideoFormat(null)
// We'll advertize as supporting all video formats.
protected Format supportedOuts[] = new Format [] {
new VideoFormat(null)
Format input = null, output = null;
public String getName() {
return "Pre-Access Codec";
// No op.
public void open() {
// No op.
public void close() {
// No op.
public void reset() {
public Format [] getSupportedInputFormats() {
return supportedIns;
public Format [] getSupportedOutputFormats(Format in) {
if (in == null)
return supportedOuts;
else {
// If an input format is given, we use that input format
// as the output since we are not modifying the bit stream
// at all.
Format outs[] = new Format[1];
outs[0] = in;
return outs;
public Format setInputFormat(Format format) {
input = format;
return input;
public Format setOutputFormat(Format format) {
output = format;
return output;
public int process(Buffer in, Buffer out) {
// This is the "Callback" to access individual frames.
accessFrame(in);
// Swap the data between the input & output.
Object data = in.getData();
in.setData(out.getData());
out.setData(data);
// Copy the input attributes to the output
out.setFlags(Buffer.FLAG_NO_SYNC);
out.setFormat(in.getFormat());
out.setLength(in.getLength());
out.setOffset(in.getOffset());
return BUFFER_PROCESSED_OK;
public Object[] getControls() {
return new Object[0];
public Object getControl(String type) {
return null;
public class PostAccessCodec extends PreAccessCodec {
// We'll advertize as supporting all video formats.
public PostAccessCodec() {
supportedIns = new Format [] {
new RGBFormat()
* Callback to access individual video frames.
void accessFrame(Buffer frame) {
// For demo, we'll just print out the frame #, time &
// data length.
if(!alreadyPrnt)
BufferToImage stopBuffer = new BufferToImage((VideoFormat)frame.getFormat());
System.out.println(stopBuffer.toString());
System.out.println("CreatedBuffer");
System.out.println("Created stopImage");
Image stopImage = stopBuffer.createImage(frame);
System.out.println("stopImage is full");
if(stopImage == null)
System.out.println("stopImage is null");
try
BufferedImage outImage = new BufferedImage (320, 240,BufferedImage.TYPE_INT_RGB);
Graphics og = outImage.getGraphics();
og.drawImage(stopImage,0,0,320,240,null);
//prepareImage(outImage,rheight,rheight, null);
Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
ImageWriter writer = (ImageWriter)writers.next();
//Once an ImageWriter has been obtained, its destination must be set to an ImageOutputStream:
File f = new File("frames\\"+frame.getSequenceNumber() + ".jpg");
ImageOutputStream ios = ImageIO.createImageOutputStream(f);
writer.setOutput(ios);
//Finally, the image may be written to the output stream:
//BufferedImage bi;
//writer.write(imagebi);
writer.write(outImage);
ios.close();
catch(IOException e)
System.out.println("Error :" + e);
//alreadyPrnt = true;
long t = (long)(frame.getTimeStamp()/10000000f);
System.err.println("Post: frame #: " + frame.getSequenceNumber() +
", time: " + ((float)t)/100f +
", len: " + frame.getLength());
if(frame.getLength()==0){p.stop();p.close();p.deallocate();}
public String getName() {
return "Post-Access Codec";
this code capture every frame from movie but it never ends running and i can't invoke any metod after grabing frames becouse its still running. How Can I stop this to enter the next metod.
Please help me
thxAnswering sam04 question Yes this make that every frame is captured
Back to my problem :
I invoke caputre frames class from other class like this:
Film2ramki f2r=new Film2ramki();
f2r.startnow(pathtomov);
System.out.println("End of capture");...........................
So when capturing frames ends it should print "End of caputre" but I get something like this :
JPEG, 320x240, FrameRate=13.0, Length=18198
Video format: JPEG, 320x240, FrameRate=13.0, Length=18198
Pre: frame #: 1, time: 0.0, len: 16282
Post: frame #: 1, time: 0.0, len: 230400
End of capture
Pre: frame #: 2, time: 0.07, len: 16471
Post: frame #: 2, time: 0.07, len: 230400
Pre: frame #: 3, time: 0.15, len: 16620
Post: frame #: 3, time: 0.15, len: 230400
Pre: frame #: 4, time: 0.23, len: 16541
Post: frame #: 4, time: 0.23, len: 230400
Pre: frame #: 5, time: 0.3, len: 16749
Pre: frame #: 18, time: 1.3, len: 15708
Post: frame #: 18, time: 1.3, len: 230400
Pre: frame #: 18, time: 1.3, len: 0
Post: frame #: 18, time: 1.3, len: 0this is strange becouse it captures 1 frame end print "End of capture" and then its capures other frames. Why ????? -
Problem with simple drawing program - please help!
Hi,
I've only just started using Java and would appreciate some help with a drawing tool application I'm currently trying to write.
The problem is that when the user clicks on a button at the bottom of the frame, they are then supposed to be able to produce a square or circle by simply clicking on the canvas.
Unfortunately, this is not currently happening.
Please help!
The code for both classes is as follows:
1. DrawToolFrame Class:
import java.awt.*;
import java.awt.event.*;
public class DrawToolFrame extends Frame
implements WindowListener
DrawToolCanvas myCanvas;
public DrawToolFrame()
setTitle("Draw Tool Frame");
addWindowListener(this);
Button square, circle;
Panel myPanel = new Panel();
square = new Button("square"); square.setActionCommand("square");
circle = new Button("circle"); circle.setActionCommand("circle");
myPanel.add(square); myPanel.add(circle);
add("South", myPanel);
DrawToolCanvas myCanvas = new DrawToolCanvas();
add("Center", myCanvas);
square.addMouseListener(myCanvas);
circle.addMouseListener(myCanvas);
public void windowClosing(WindowEvent event) { System.exit(0); }
public void windowOpened(WindowEvent event) {}
public void windowIconified(WindowEvent event) {}
public void windowDeiconified(WindowEvent event) {}
public void windowClosed(WindowEvent event) {}
public void windowActivated(WindowEvent event) {}
public void windowDeactivated(WindowEvent event) {}
2. DrawToolCanvas Class:
import java.awt.*;
import java.awt.event.*;
public class DrawToolCanvas
extends Canvas
implements MouseListener, ActionListener {
String drawType="square";
Point lastClickPoint=null;
public void drawComponent(Graphics g) {
if (lastClickPoint==null) {
g.drawString("Click canvas first",20,20);
} else {
if (drawType.equals("square")) {
square(g);
else if (drawType.equals("circle")) {
circle(g);
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand().equals("square"))
drawType="square";
else if (event.getActionCommand().equals("circle"))
drawType="circle";
repaint();
public void mouseReleased(MouseEvent e) {
lastClickPoint=e.getPoint();
public void square(Graphics g) {
g.setColor(Color.red);
g.fillRect(lastClickPoint.x, lastClickPoint.y, 40, 40);
g.setColor(Color.black);
public void circle(Graphics g) {
g.setColor(Color.blue);
g.fillOval(lastClickPoint.x, lastClickPoint.y, 40, 40);
g.setColor(Color.black);
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseClicked(MouseEvent e) {}
Any help would be appreciated!Some of the problems:
1) nothing calls drawComponent(Graphics g)
2) Paint(Graphics g) has not been overriden
3) myCanvas is declared twice: once as an instance variable to DrawToolFrame, and once local its constructor. Harmless but distracting. -
Problem in creating DB Link - Please help
Hi ,
I created a DB Link with name "CTM_DBLINK".
i want to create DB Link with different name but using same server and connection also same.
When i am trying this its shows error :
"ORA-00933:SQL Command not properly ended."
My Query :
create public database link "CTM_BANK"
connect to ABC
identified by <pwd>
using 'database';
i am getting error on line 3 : identified by <pwd>
Please help , its urgent.
SurenderTry enclosing the password in quotes.
Same problem occurs if you try to create a user using the password you have given.
SQL> create user abc identified by abc!;
create user abc identified by abc!
ERROR at line 1:
ORA-00922: missing or invalid option
SQL> create user abc identified by "abc!" ;
User created.
To create the database link, try this:
SQL> CREATE PUBLIC DATABASE LINK "CTM_BANK" CONNECT TO "ABC"
2 IDENTIFIED BY "abc!"
3 USING 'database' ;
Database link created.
Hope that helps!
Regards.
RK -
Problem With Swf File. Please Help!!!!
Hi! I recently got adobe flash cs4 and i tried to create swf wallpaper (flash lite 1.1), so everything looked good, untill i opened the file. The problem is its constantly blinking, like its refreshing with every second or frame or something. Then i transfered it to my phone and theres no change. I had the same problem with CS3...I attached the sample, if someone cares to see...Please can somebody help me??? Thank you!
I think (at a first look) that you should put a stop() command at each frame of your movie.
Playhead is running through your movie from one frame to another and back to beginning if you don't stop it with stop() command.
What I mean is:
in frame one of your movie put ActionScript: stop();
in frame two of your movie put ActionScript: stop();
etc.
If navigation through your movie is linear, like some animations then don't put this AS in frames, but it seems to me that this will solve your problem.
For more (if this isn't helping) upload your movie along with ActionScript. -
Having problem with switch statement..please help
here my question :
GUI-based Pay Calculator
A company pays its employees as executives (who receive a fixed weekly salary) and hourly workers (who receive a fixed hourly salary for the first 40 hours they work in a week, and 1.5 times their hourly wage for overtime worked).
Each category of employee has its own paycode :
? Paycode 1 for executives
? Paycode 2 for hourly workers
Write a GUI-based application to compute the weekly pay for each employee. Use switch to compute each employee?s pay based on that employee?s paycode.
Use CardLayout layout manager to display appropriate GUI components. Obtain the employee name, employee paycode and other necessary facts from the user to calculate the employee?s pay based on the employee paycode:
? For paycode 1, obtain the weekly salary.
? For paycode 2, obtain the hourly salary and the number of hours worked.
You may obtain other information which you think is necessary from the user.
Use suitable classes for the GUI elements. (You can use javax.swing package or java.awt package for the GUI elements.)
here my code so far :
import java.awt.;*
import java.awt.event.;*
import javax.swing.;*
*public class PayrollSystem implements ItemListener {*
JPanel cards, JTextField, textField1, JLabel, label1;
final static String EXECUTIVEPANEL = "1.EXECUTIVE";
final static String HOURLYPANEL = "2.HOURLY WORKER";
public void addComponentToPane(Container pane)
*//Put the JComboBox in a JPanel to get a nicer look.*
JPanel comboBoxPane = new JPanel(); //use FlowLayout
JPanel userNameAndPasswordPane = new JPanel();
*// User Name JLabel and JTextField*
userNameAndPasswordPane.add(new JLabel("NAME"));
JTextField textField1 = new JTextField(25);
userNameAndPasswordPane.add(textField1);
*String comboBoxItems[] = { EXECUTIVEPANEL, HOURLYPANEL };*
JComboBox cb = new JComboBox(comboBoxItems);
cb.setEditable(false);
cb.addItemListener(this);
comboBoxPane.add(cb);
*//Create the "cards".*
JPanel card1 = new JPanel();
card1.add(new JLabel("WEEKLY SALARY"));
card1.add(new JTextField(6));
card1.add(new JLabel("TOTAL PAY"));
card1.add(new JTextField(8));
card1.add(new JButton("CALCULATE"));
JPanel card2 = new JPanel();
card2.add(new JLabel("HOURLY SALARY"));
card2.add(new JTextField(6));
card2.add(new JLabel("TOTAL HOURS WORK"));
card2.add(new JTextField(8));
card2.add(new JButton("CALCULATE"));
*//Create the panel that contains the "cards".*
cards= new JPanel(new CardLayout());
cards.add(card1, EXECUTIVEPANEL);
cards.add(card2, HOURLYPANEL);
pane.add(comboBoxPane, BorderLayout.PAGE_START);
pane.add(userNameAndPasswordPane, BorderLayout.CENTER);
pane.add(cards, BorderLayout.PAGE_END);
public void itemStateChanged(ItemEvent evt)
CardLayout cl = (CardLayout)(cards.getLayout());
cl.show(cards, (String)evt.getItem());
** GUI created*
*private static void createAndShowGUI() {*
*//Make sure we have nice window decorations.*
JFrame.setDefaultLookAndFeelDecorated(true);
*//Create and set up the window.*
JFrame frame = new JFrame("GUI PAY CALCULATOR");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
*//Create and set up the content pane.*
PayrollSystem demo = new PayrollSystem();
demo.addComponentToPane(frame.getContentPane());
*//Display the window.*
frame.pack();
frame.setVisible(true);
*public static void main(String[] args) {*
*//Schedule a job for the event-dispatching thread:*
*//creating and showing this application's GUI.*
*javax.swing.SwingUtilities.invokeLater(new Runnable() {*
*public void run() {*
createAndShowGUI();
HOW CAN I PERFORM THE SWITCH STATEMENT INSIDE THIS CODE TO LET IT FULLY FUNCTIONAL..?
I MUST PERFORM THE SWITCH STATEMENT LIKE IN THE QUESTION..
PLEASE HELP ME..REALLY APPRECIATED...TQhi
A switch works with the byte, short, char, and int primitive data types. So you can simply give the
switch (month) {
case 1:
System.out.println("January");
break;
case 2: {
System.out.println("February");
break;
case 3: {
System.out.println("March");
break;
}where month controlls the flow
moreover u can go to http://www.java-samples.com/java/free_calculator_application_in_java.htm
for reference, just replace the if statement with switch with correct syntax -
I have problem with my account icloud please help me
i have problem with my account icloud as i am trying to delete "find my iPhone" in order to format my iPhone .. The main problem in my mobile as my mobile cannot be connected with the data service and "searching" word is appear. Note: my SIM is working
Hi ELMIR_012,
Thanks for visiting Apple Support Communities.
It sounds like you may be setting up your iPhone after updating to iOS 7.
You may want to skip signing into your Apple ID (iCloud account) until your phone is set up. You will be able to sign into your iCloud account later. See this article for more information:
iPhone, iPad, iPod touch: How to get started
http://support.apple.com/kb/ht4053
Sign in with your Apple ID, which you've created previously, or create a free Apple ID.
Alternatively, you can tap Skip This Step to sign in or create an Apple ID later.
If you require assistance with your Apple ID, please see Apple ID Support for more information.
Additionally, this page can help with resetting your password:
Apple ID: If you forget your password
http://support.apple.com/kb/ht5787
Best Regards,
Jeremy -
MIR7...a problem with an invoice..PLEASE HELP!!!
Hi all,
i just want to create a preliminary invoice in the Tx. MIR7, but something happen with the item i want to add to the invoice and, doesnt let me create the preliminary invoice a throw the follow "error": Error in routing MRM_DRSEG_FILL(SAPLMRMH). Why the Tx. shows me that "error"?. Please help, i'm debugging the standard and i cant figure out what is the problem with the item.
Thanx in advanceHi Mariana ,
I am facing exactly the same error.
Can you please guide as to how you solved the problem.
Regards
Suman Chakraborty -
Problem with threads and simulation: please help
please help me figure this out..
i have something like this:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DrawShapes extends JApplet{
private JButton choices[];
private String names[]={"line", "square", "oval"};
private JPanel buttonPanel;
private DrawPanel drawingArea;
private int width=300, height=200;
public void init(){
drawingArea=new DrawPanel(width, height);
choices=new JButton[names.length];
buttonPanel=new JPanel();
buttonPanel.setLayout(new GridLayout(1, choices.length));
ButtonHandler handler=new ButtonHandler();
for(int i=0; i<choices.length; i++){
choices=new JButton(names[i]);
buttonPanel.add(choices[i]);
choices[i].addActionListener(handler);
Container c=getContentPane();
c.add(buttonPanel, BorderLayout.NORTH);
c.add(drawingArea, BorderLayout.CENTER);
}//end init
public void setWidth(int w){
width=(w>=0 ? w : 300);
public void setHeight(int h){
height=(h>=0 ? h : 200);
/*public static void main(String args[]){
int width, height;
if(args.length!=2){
height=200; width=300;
else{
width=Integer.parseInt(args[0]);
height=Integer.parseInt(args[1]);
JFrame appWindow=new JFrame("An applet running as an application");
appWindow.addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
DrawShapes appObj=new DrawShapes();
appObj.setWidth(width);
appObj.setHeight(height);
appObj.init();
appObj.start();
appWindow.getContentPane().add(appObj);
appWindow.setSize(width, height);
appWindow.show();
}//end main*/
private class ButtonHandler implements ActionListener{
public void actionPerformed(ActionEvent e){
for(int i=0; i<choices.length; i++){
if(e.getSource()==choices[i]){
drawingArea.setCurrentChoice(i);
break;
}//end class DrawShapes
class DrawPanel extends JPanel{
private int currentChoice=-1;
private int width=100, height=100;
public DrawPanel(int w, int h){
width=(w>=0 ? w : 100);
height=(h>=0 ? h : 100);
public void paintComponent(Graphics g){
super.paintComponent(g);
switch(currentChoice){
case 0: g.drawLine(randomX(), randomY(), randomX(), randomY());
break;
case 1: g.drawRect(randomX(), randomY(), randomX(), randomY());
break;
case 2: g.drawOval(randomX(), randomY(), randomX(), randomY());
break;
public void setCurrentChoice(int c){
currentChoice=c;
repaint();
private int randomX(){
return (int) (Math.random()*width);
private int randomY(){
return (int) (Math.random()*height);
}//end class drawPanel
That one's from a book. I used that code to start with my applet. Mine calls different merthod from the switch cases. Say I have:
case 0: drawStart(g); break;
public void drawStart(Graphics g){
/* something here */
drawMain(g);
public void drawMain(graphics g){
g.drawString("test", x, y);
//here's where i'm trying to pause
//i've tried placing Thread.sleep between these lines
g.drawLine(x, y, a, b);
//Thread.sleep here
g.drawRect(x, y, 50, 70);
}I also need to put delays between method calls but I need to synchronize them. Am I doing it all wrong? The application pauses or sleeps but afterwards, it still drew everything all at once. Thanks a lot!It is. Sorry about that. Just answer any if you want to. I'd appreciate your help. Sorry again if it caused you anything or whatever. .n_n.
-
Problem with adobe acrobat/reader - please help!
Hello,
My acrobat reader was fine and I was able to open the pdf files sent to me, then suddenly it just wouldn't open anything at all. It went into open mode and just stayed there, and wouldn't let me close it. Then I got a message saying "there is a problem with adobe acrobat/reader. Please exit and try again". I've done this lots of times and it still isn't working.
I would be very grateful for any help or suggestions. I have windows 7, and as I said its all been fine up until now.
Thanks.
mspryce.This is the Acrobat forum, not the Reader forum. You should check the reader forum. In the meantime, if you are not running AR9.3 or so, you should update. Prior versions before 9 are not designed for Win7 and that might be your issue -- you gave no indication of version.
-
Problem with my 3gs!please help
need help! i just upgrade my 3gs to ios 5..but got problem with it..it says no sim..but the sim card is in it.can anyone help me?how do i fix this?
here its is step by step,
step 1 :- pluging iphone in ur laptop
step 2 :- open itunes and
step3 :- create new playlist ... here same picture
step :- 4 picture here
step :- when u create a new playlist click in ur playlist ....
step 6 :- when u drage all music in ur playlist then click ur devic and click sync ....
now ur playlist ready ...... enjyyyy with ur music -
Problem with Logic XS Key, PLEASE HELP
I use my G4 Powerbook laptop for live. I am running most recent version of logic.
What happens is that Logic will load up fine, but then for no apparent reason logic will come up with an error message saying that the logic key has been removed, but i have not touched it!! I then have to restart logic.
PLease help i have to get this sorted ASAP cuz i have a gig tomorrow nite. Cheers guysHmm, it does it on both USB ports? And you haven't noticed any problems with other USB gear on those ports?
When the key is next not recognised by Logic, go into the system profiler and find your USB port that the XS key is on - the XS key will be labelled when it's functioning correctly. Is it still recognised by the computer, or has it gone completely?
Maybe you are looking for
-
Hi, Just a little question, I've had to do a manual backup recently and it took quite a very long time to complete. I've noticed that the backup that occurs before syncing the iPhone (4S ios 8.1 in my case) with Itunes (last version) doesn't take tha
-
Open a Dreamweaver Page in a new tab
Has anyone been able to create a hyperlink that opens a new tab rather than a new instance of the browser and if so, how?
-
Non-WLS client VMs using NonCatalogLogger
Hi All- I've been playing around with the weblogic.logging.NonCatalogLogger. It works great. I'm even able to filter by subsystem when browsing the log file from the Administration Console. I have a couple of questions, though: 1.. How can I get a cl
-
Why is my MacBook charger not working?
My MacBook was charging fine a couple of days ago and now when I plug it in it won't charge. My computer is going to die soon and I have no way of charging it. HELP.
-
Where to download InDesign CC debug version?
After finally having access to the InDesign CC SDK I am now presented with the problem of debugging a built plugin. Where can i get the InDesign CC (9.2 specifically) debug version?