Can't gotoAndStop ...what's wrong with this button code?
Hi,
I'm totally stumped as to why I can't navigate to another frame.
I have put 2 days into this simple problem now and I'm ready to give up and go back to AS2.
Please help!
I'm using CS4; publish settings AS3, 10.0
I have a button on frame 2 that should take me to frame 3 when clicked.
(So far I've tried a hundred different ways but I don't get to frame 3...)
Different things I tried...
> Creating the button dynamically from the library...
> Inserting it statically from the library on frame 2...
> referencing the mainTimeline through a variable...
> wrapping the gotoAndStop action in another function...(if placed directly on the timeLine the movie correctly goes straight to frame 3)
> naming frame 3...
> using 'nextFrame' instead of 'gotoAndStop'...
etc..
In most cases I don't get an error in the output panel and no compiler error either; it just doesn't work!!!
(Just stays on the same frame after I click the button)
Here's the code I think should work; but doesn't:
function moveTo3 (event:MouseEvent):void {
trace("button_clicked"); // always traces correctly; but movie does not go to frame 3 !!!
gotoAndStop(3);
f_btn.addEventListener(MouseEvent.CLICK, moveTo3);
WHAT AM I MISSING HERE?
Thanks in advance ...
Hi Ned,
I have to run out and don't have the time to deal with it right now but you're RIGHT.
I do have an 'onEnterFrame' listener on frame 1 !
It's doing some animation with a symbol and I don't think I removed the listener itself.
I just set the object to null when it reached [alpha:0].
THANKS!
I'll check it out as soon as I can but I really think you got me looking in the right direction now.
Thanks again,
Connor
(I'll post an update when I get back to it)
Similar Messages
-
What's wrong with this button code
Dear All,
I am trying to set up a button handler for many buttons
rather just one. The
intention of this code is to say if I press Load1 to Load40
that button and
only that button's alpha should change to 50%. This code
makes them all 50%
alpha when the frame loads rather than on the onPress event.
Can someone please help me out with this one?
i = 0;
while (i<40) {
this["Load"+i].onPress = btnEvaluate(this["Load"+i]);
++i;
function btnEvaluate(target_btn:Button) {
target_btn._alpha = 50;
Thanks again.
Alastair MacFarlanekglad,
Thanks again. What would this group do without your help.
Alastair
"kglad" <[email protected]> wrote in message
news:gh0sq0$cbv$[email protected]..
> :
>
>
>
> for (var i = 0;i<40;i++) {
> this["Load"+i].onPress =function(){
> this._alpha=50;
> }
> } -
What's wrong with this simple code?
What's wrong with this simple code? Complier points out that
1. a '{' is expected at line6;
2. Statement expected at the line which PI is declared;
3. Type expected at "System.out.println("Demostrating PI");"
However, I can't figure out them. Please help. Thanks.
Here is the code:
import java.util.*;
public class DebugTwo3
// This class demonstrates some math methods
public static void main(String args[])
public static final double PI = 3.14159;
double radius = 2.00;
double area;
double roundArea;
System.out.println("Demonstrating PI");
area = PI * radius * radius;
System.out.println("area is " + area);
roundArea = Math.round(area);
System.out.println("Rounded area is " + roundArea);Change your code to this:
import java.util.*;
public class DebugTwo3
public static final double PI = 3.14159;
public static void main(String args[])
double radius = 2.00;
double area;
double roundArea;
System.out.println("Demonstrating PI");
area = PI * radius * radius;
System.out.println("area is " + area);
roundArea = Math.round(area);
System.out.println("Rounded area is " + roundArea);
Klint -
Can anybody see what is wrong with this SQL statement?
Hey guys, just a quick question. Can anybody tell me what is wrong with this line of SQL? I keep getting a syntax error message. I've been trying for ages and I can't see any problem at all!"
{code}prepStat = connection.prepareStatement("INSERT INTO WeatherHistory (Date, Location, Overview, Temperature, WindDirection, WindSpeed, Pressure) VALUES ('"+date+"','"+location+"','"+temp+"','"+windDir+"','"+windSpd+"','"+pressure+"')");{code}
All the field names and variables definitely exist so I can't see what the problem is!DHD wrote:
Thanks for the replies.
I've matched the correct number of column names and variables, but still no luck.
And how exactly am I misusing Prepared Statements here?As noted above, not according to the code you posted. I didn't just pluck something out of my @ss and throw it out there. There was a reason behind what I said. And, if you mean you changed it, and you still got an exception, then post that exception (completely), and your new code, which is, hopefully, using PreparedStatement, (properly). -
What's wrong with this mini-code? (Trying to draw graphics).
Could someone please help me fix what's wrong the following test-program?:
package project;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class GraphicsTester extends JPanel
JPanel thePanel = this;
public void GraphicsTester()
JFrame frame = new JFrame();
frame.setSize(600,600);
frame.add(thePanel);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
protected void paintComponent(Graphics g)
super.paintComponent(g);
g.drawRect(50, 50, 50, 50);
System.out.println("Sup fool");
public static void main(String[] args)
GraphicsTester gt = new GraphicsTester();
System.out.println("works2");
}Any help would be greatly appreciated!
Thanks in advance!Also, all Swing code should be called from the Event Dispatch Thread. It probably isn't hurting much in your case. But, in the body of main, do this (instead of the comment, put what you currently have as the body of main):
EventQueue.invokeLater(
new Runnable()
public void run()
// Your current body of main.
}); -
What's wrong with this widget code?
Hi everyone,
(I hope this is a good place to put this) I'm trying to build a widget in Dashcode, and one of the things I want to do is run a system command (specifically "ps -ax"). I enabled command line access in the widget attributes, and I now have:
var processes = widget.system("/bin/ps -ax", NULL);
The problem is that "processes" is always undefined. I read on here that there's a bug that if the output is too long, then the variable is undefined. So I tried substituting the command with this:
var processes = widget.system("/bin/ls ~/", NULL);
When I run the command in Terminal, the output is minimal:
Desktop Documents Downloads Library Movies Music Pictures Public Sites
But when I try to run that in Dashcode, it still returns undefined. Am I missing something obvious here?bump I'm still at a standstill with this. Any ideas?
Thanks! -
Pictrivia 6 - Can you identify what's wrong with this setup?
What's Pictrivia?
It's a trivia presented as a picture - more picture, less words. If you love solving puzzles, racking your brains on brain teasers,you would love this one.
Who can participate?
It's open to all. You can participate on Facebook, Twitter or here. If you are subscribed to our Facebook or Twitter channels, you'll see the message posted on early Saturday mornings pacific time.
How often will you post a trivia?
Once a week on Fridays.
How do I answer?
You can answer by replying to this discussion. If you saw the post on our Facebook page or Twitter, simply comment on the post or reply to our tweet.
What do I get?
Intellectual stimulation, thrill and pleasure of solving a puzzle!
What's the skill level required?
Beginners
When will I know the right answer?
On the following Wednesday.Access layer switch will became bridge root。(default priority,lowest MAC address 1111.1111.1111)。And this L2 network will working at low efficiency。
-
Can someone see what is wrong with this? Im stumped
public class Card {
int suit;
int value;
static int isStraight = 0;
static int isFlush = 0;
static int handCounter = 0;
static int cardCounter = 0;
boolean inUse = false;
public int getSuit() {
return suit;
public void setSuit(int suit) {
this.suit = suit;
public int getValue() {
return value;
public void setValue(int value) {
this.value = value;
public boolean isInUse() {
return inUse;
public void setInUse(boolean inUse) {
this.inUse = inUse;
public static int checkPairs(int[] handValues){
for (int x = 0; x<5; x++ ){
for (int y = 0; y<5; y++ ){
if(handValues[x]==handValues[y]){
cardCounter ++;
handCounter = handCounter + (cardCounter - 1);
cardCounter = 0;
System.out.println(handCounter);
return handCounter;
public static int checkStraight(int[] handValues){
if(handValues[0] == (handValues[1]-1)){
if (handValues[1] == (handValues[2]-1)){
if (handValues[2] == (handValues[3]-1)){
if (handValues[3] == (handValues[4]-1)){
///System.out.println("straight");
isStraight = 1;
if (handValues[4] == 12){
isStraight = 2;
return isStraight;
public static int checkFlush(Card[]inputHand){
if (inputHand[0].suit == inputHand[1].suit){
if (inputHand[1].suit == inputHand[2].suit){
if (inputHand[2].suit == inputHand[3].suit){
if (inputHand[3].suit == inputHand[4].suit){
isFlush = 1;
return isFlush;
//handCheckerApp ,
import tcdIO.*;
public class handCheckerApp {
///these string arrays just hold the names of the values
static String[] suitsArray = {"hearts" , "spades" , "diamonds" , "clubs" };
static String[] valuesArray = {"two" , "three" , "four" , "five" , "six" , "seven" , "eight" , "nine" , "ten" , "jack" , "queen" , "king" ,"ace" };
public static void main (String arguments []) {
Terminal terminal = new Terminal();
Card[] inputHand = new Card[5];
Card[] deck = new Card[52];
Card currentCard = new Card();
for(int number = 0 ; number <= 12 ; number++){
deck[number]= new Card();
deck[number].suit = 0;
deck[number].value = number;
for(int number = 13 ; number <= 25 ; number++){
deck[number]= new Card();
deck[number].suit = 1;
deck[number].value = (number - 13);
for(int number = 26 ; number <= 38 ; number++){
deck[number]= new Card();
deck[number].suit = 2;
deck[number].value = (number - 26);
for(int number = 39 ; number <= 51 ; number++){
deck[number]= new Card();
deck[number].suit = 3;
deck[number].value = (number - 39);
terminal.println("Poker Hand Checker");
terminal.println("~~~~~~~~~~~~~~~~~~");
terminal.println("Suits key:..Hearts = 1");
terminal.println("...................Spades = 2");
terminal.println("...................Diamonds = 3");
terminal.println("...................Clubs = 4");
terminal.println(".............................");
terminal.println("Values key:.Twos = 2");
terminal.println("......................Threes = 3");
terminal.println("......................Fours = 4");
terminal.println("......................Fives = 5");
terminal.println("......................Sixes = 6");
terminal.println("......................Sevens = 7");
terminal.println("......................Eights = 8");
terminal.println("......................Nines = 9");
terminal.println("......................Tens = 10");
terminal.println("......................Jacks = 11");
terminal.println("......................Queens = 12");
terminal.println("......................Kings = 13");
terminal.println("......................Aces = 14");
///this block of code marks cards in the deck as in use and adds them to the hand
for(int i = 0; i < 5; i++){///for1
currentCard.value = (terminal.readInt("please enter card " + (i+1) + " value: " )-2);
currentCard.suit = (terminal.readInt("please enter card " + (i+1) + " suit: " )-1);
for (int x = 0; x< 52; x++){///for2
if (deck[x].value == currentCard.value){///if1
if (deck[x].suit == currentCard.suit){///if2
if (deck[x].inUse == true){///elseif1
terminal.println("you chose that card already");
i--;
}///if3
else if(deck[x].inUse == false){///if3
deck[x].inUse = true;
inputHand[i] = deck[x];
terminal.println("this card is the " + valuesArray[(inputHand.value)] + " of " + suitsArray[(inputHand[i].suit )]);
}///elseif1
}///if2
}///if1
}///for2
}///for1
int handValues[] = {inputHand[0].value, inputHand[1].value, inputHand[2].value, inputHand[3].value, inputHand[4].value};
java.util.Arrays.sort(handValues);
///this method checks for pairs, two pairs, three of a kind, full house & four of a kind
Card.checkPairs(handValues);
if (Card.handCounter == 2) {
terminal.println("You have a pair");
if (Card.handCounter == 4) {
terminal.println("You have two pair");
if (Card.handCounter == 6) {
terminal.println("You three of a kind");
if (Card.handCounter == 8) {
terminal.println("You have a full house");
if (Card.handCounter == 12) {
terminal.println("You have four of a kind");
} else {
terminal.println("");
Card.checkStraight(handValues);
Card.checkFlush(inputHand);
if (Card.isStraight == 1 && Card.isFlush == 0){
terminal.println("You have a straight");
if (Card.isStraight == 1 && Card.isFlush == 1){
terminal.println("You have a straight flush");
if (Card.isStraight == 2 && Card.isFlush == 0){
terminal.println("You have a royal straight");
if (Card.isStraight == 2 && Card.isFlush == 1){
terminal.println("You have a royal straight flush");
if (Card.isStraight == 0 && Card.isFlush == 1){
terminal.println("You have a flush");
if (Card.isStraight == 0 && Card.isFlush == 0){
terminal.println("");
Okay it's not recognising deck.inUse....i can't see why.
Can someone possibly point out some suggestions. Thanks, much appreciated.> if (deck[x].inUse == true){///elseif1
>
it's giving me an error on this If else statement...
sorry ....
How about going the extra mile and actually posting the error message you receive rather than expecting everyone to guess? The more pertinent information you can provide, the easier it is to answer your question. And you want your question answered easily and quickly, right?
~ -
Can i know what is wrong with this sql?
i have an error of invalid character.
SELECT SUM(counter),TO_DATE(logdatetime)
FROM NYP_LIBPORTAL.PORTAL_HOME_NON_LOGIN_LOG
WHERE logdatetime = logdatetime
AND (TO_DATE(logdatetime, 'DD-MON-YYYY') BETWEEN
TO_DATE('01-JAN-2007', 'DD-MON-YYYY') AND TO_DATE('31-JAN-2007', 'DD-MON-YYYY'))
GROUP BY TO_DATE (logdatetime);
May i know is there any way that i need to make the changes?your problem is likely to be the TO_DATE(logdatetime) - if logdatetime is a DATE datatype, then you should never, ever use TO_DATE on it.
But I suspect this has been sorted in a later post of yours? -
What is wrong with this idoc code snip?
Hi all here's the code that's supposed to give me a default value for a metadata in check-in:
1. <$if dDocAccount like "test*"$>
2. <$dprDefaultValue="Test"$>
3. <$elseif userHasRole("TesterA") or userHasRole("TesterB")$>
4. <$dprDefaultValue="A or B"$>
5. <$elseif userHasRole("TesterC") or userHasRole("TesterD")$>
6. <$dprDefaultValue="C or D"$>
7. <$else$>
8. <$dprDefaultValue="Not A nor B nor C nor D"$>
9. <$endif$>
Now if I leave the code like that only the first 2 lines work meaning that if first condition fails then the whole code stops working even though line 3 is true... is there something wrong in just calling dDocAccount on its own? never seen that happen before.
If I change that first line for <$if *#active.* dDocAccount like "test*"$> then this first condition won't work but the rest (line 3+) does work!
please help!!Hmmmm,
If your first two lines work if true then the issue is with the elseif lines right?
userHasRole("foo") returns true or false. Can you wrap userHasRole("foo") in an "isTrue()" function and test that way?
What about exploding the OR statement and writing a bunch of elseifs to see if it works that way.
The other thing you can do is to wrap your OR clause itself in parens
<$elseif ((userHasRole("foo")) or (userHasRole("bar")))$>
do stuff
<$endif$>
let us know what works for you
Warmly,
Billy Cripe
Fishbowl Solutions -
Does any one know what is wrong with this servlet code
package com.bt.ros;
import java.util.*;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
* This class is a servlet that searches for a Finder Aid.
* @author
public class FinderAidsSearchS extends HttpServlet {
* This is the static initializer,
* executed the first time this class is referred to.
* It makes sure the JDBC pool driver is loaded.
* This method examines an HTTP request and searches for the
* specified Finder Aid record in the database. It then redirects
* the response to the <tt>Results.jsp</tt> JSP page.
public void service(HttpServletRequest req, HttpServletResponse res)
throws IOException
HttpSession session = req.getSession(true);
//res.setContentType("text/html");
//PrintWriter out = res.getWriter( );
//out.println("<HTML>");
//out.println("<HEAD>");
//out.println("<TITLE>");
//out.println("A Servlet Example");
String year = req.getParameter("Year");
String year_range = req.getParameter("Year_Range");
String county = req.getParameter("County");
Connection conn = null;
try {
//example code from tomcatmanual
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/rosDS");
//Connection
conn = ds.getConnection();
Statement stmt = conn.createStatement();
String select = "select * from abridgment where " +
"(a_county = '" + county +
"' AND a_year_date = " + year +
out.println("<DEBUG> <select> the select staement is : " + select);
stmt.execute(select);
ResultSet resultSet = stmt.getResultSet();
Results abridgeresults = new Results();
abridgeresults.setName("NaeemColl");
Abridgment varabridgment = null;
int nRows = 0;
while(resultSet.next()){
nRows++;
varabridgment = new Abridgment();
varabridgment.seta_county(county);
varabridgment.seta_year_date(Integer.parseInt(year));
varabridgment.seta_sub_year_volume(resultSet.getInt("a_sub_year_volume"));
// out.println("varabridgment - attributes are:");
//out.println("varabridgment - attributes are:" +varabridgment.geta_sub_year_volume());
//out.println("varabridgment - attributes are:"+resultSet.getInt("a_sub_year_volume"));
varabridgment.seta_page_id(resultSet.getString("a_page_id"));
varabridgment.seta_month_date(resultSet.getInt("a_month_date"));
varabridgment.seta_day_date(resultSet.getInt("a_day_date"));
varabridgment.seta_year_sequence(resultSet.getLong("a_year_sequence"));
varabridgment.seta_day_sequence(resultSet.getLong("a_day_sequence"));
varabridgment.seta_year_volume(resultSet.getInt("a_year_volume"));
varabridgment.seta_volume_id(resultSet.getString("a_volume_id"));
varabridgment.seta_summary(resultSet.getString("a_summary"));
varabridgment.seta_batch_id(resultSet.getLong("a_batch_id"));
varabridgment.seta_image_id(resultSet.getLong("a_image_id"));
abridgeresults.addAbridgment(varabridgment);
//trying to use vector construct
req.setAttribute("results",abridgeresults);
//session.setAttribute("results", abridgeresults);
stmt.close();
conn.close();
//out.println("</BODY>");
//out.println("</HTML>");
// String sURL = res.encodeRedirectURL("/rossearch/results.jsp");
try{
//TEMPCOMM res.sendRedirect(sURL);
req.getRequestDispatcher("/rossearch/results.jsp").forward(req, res);
//TEMPCODE
//out.println("</BODY>");
//out.println("</HTML>");
catch(Exception e){
System.err.println("Exception: FinderAidsSearchS.service: " + e);
catch (Exception e) {
System.err.println("Exception: FinderAidsSearchS.service: " + e);
}i really need some assistance at the following areas of code :
where the database results are set to attributes of one bean varabridgment (Type Abridgement) - the declaration and use of this bean.
and where this bean is then added to another bean abridgeresults (Type Results) as a List collection.
i get a null pointer exception when i try to retrieve the List from abridgeresults object of Type Results Bean.
i would really appreciate some assistance in this - i really need to go to sleep now - but cant until i solve this issue. - thanks all in advance.below is exception outputed to tomcat log file.
it is thrown at the following line of code in the jsp that tries to get the List object :
currently jsp code to retrieve List: <% List myAbridgments = (List) request.getAttribute("results");
for (int i = 0; i < myAbridgments.size(); i++) {
abridgment = (Abridgment) myAbridgments.get(i);
%>
line that gives problem is
(results_jsp.java:95)
//myAbridgments - is variable where i store the List object in jsp scriptlet
for (int i = 0; i < myAbridgments.size(); i++) {
Also, i dont understand why the servlet keeps on forwarding to the results.jsp when i even comment out the line of code to forward request oobject to results.jsp - i recompile copy it over original and restart tomcat - but still i get the null pointer exception in results_jsp - but i'm no longer forwarding anything to this jsp. --- i want to do some out.printline statemets in servelt to see some of the data from the query - but i cant as it just forwrads the request to results.jsp - how can i output the data to look at debug - i dont have a log4j logger setup and dont have IDE to be able to place break points - so wanted to just output stuff to browser to have a look at what was going on - but can't as just forwards request on ?
Exception ....
2005-11-07 02:45:20 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)
----- Root Cause -----
java.lang.NullPointerException
at org.apache.jsp.results_jsp._jspService(results_jsp.java:95)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536) -
What is wrong with this trigger code?
Hi folks,
Just wondering whether I might be missing something here about Oracle 9i, that one of you might notice, either from the syntax perspective, or regarding a bug? The code below compiles in the database I have, but the trigger does not fire, and no data is being inserted into the tables. The trigger is owned by sys, and the insert statements are in dynamic sql because I don't want the trigger not to compile if ever the tables are deleted from the b1dev schema.
Incidentally, this same trigger works well on Oracle 10.2.1.0 and Oracle 11.1.0. Any feedback would be much appreciated.
CREATE OR REPLACE TRIGGER cc_LogOff_Trig
BEFORE LogOff ON DATABASE
DECLARE
LogOff_sid PLS_INTEGER;
LogOff_Time DATE := SYSDATE;
Table_1 VARCHAR2(30) := 'CC_SESSION_EVENT_HISTORY';
Table_2 VARCHAR2(30) := 'CC_SESSTAT_HISTORY';
Table_Count NUMBER;
v_sql1 VARCHAR2(4000);
v_sql2 VARCHAR2(4000);
BEGIN
SELECT sId
INTO LogOff_sId
FROM sys.v$MysTat
WHERE ROWNUM < 2;
SELECT COUNT(* )
INTO Table_Count
FROM dba_Objects
WHERE Object_Name = Table_1
AND Object_Type = 'TABLE';
IF Table_Count = 1 THEN
v_sql1 := 'INSERT INTO bdev.cc_session_event_history(sid, serial#, username, osuser, session_process_addr, os_client_process_id, logon_time, type, event, total_waits, total_timeouts, time_waited_csecs,
average_wait_csecs, max_wait_csecs, logoff_timestamp) SELECT se.sid, s.serial#, s.username, s.osuser, s.paddr, s.process, s.logon_time, s.type, se.event, se.total_waits, se.total_timeouts, se.time_waited, se.average_wait,
se.max_wait, '''
||LogOff_Time
||''' FROM sys.v$session_event se, sys.v$session s WHERE se.sid = s.sid AND s.username = '''
||LogIn_User
||''' AND s.sid = '
||LogOff_sId;
EXECUTE IMMEDIATE v_sql1;
END IF;
SELECT COUNT(* )
INTO Table_Count
FROM dba_Objects
WHERE Object_Name = Table_2
AND Object_Type = 'TABLE';
IF Table_Count = 1 THEN
v_sql2 := 'INSERT INTO bdev.cc_sesstat_history(username, osuser, sid, serial#, session_process_addr, os_client_process_id, logon_time, statistic#, name, VALUE, logoff_timestamp) SELECT s.username,
s.osuser, ss.sid, s.serial#, s.paddr, s.process, s.logon_time, ss.statistic#, sn.name, ss.VALUE, '''
||LogOff_Time
||''' FROM sys.v$sesstat ss, sys.v$statname sn, sys.v$session s
WHERE ss.statistic# = sn.statistic# AND ss.sid = s.sid AND sn.name IN(''CPU used when call started'', ''CPU used by this session'', ''recursive cpu usage'', ''parse time cpu'')
AND s.username = '''
||Login_User
||''' AND s.sid = '
||LogOff_sId;
EXECUTE IMMEDIATE v_sql2;
END IF;
COMMIT;
END;
desc cc_session_event_history;
Name Null Type
SID NUMBER
SERIAL# NUMBER
USERNAME VARCHAR2(30)
OSUSER VARCHAR2(30)
SESSION_PROCESS_ADDR RAW(0)
OS_CLIENT_PROCESS_ID VARCHAR2(24)
LOGON_TIME DATE
TYPE VARCHAR2(10)
EVENT VARCHAR2(64)
EVENT# NUMBER
TOTAL_WAITS NUMBER
TOTAL_TIMEOUTS NUMBER
TIME_WAITED_CSECS NUMBER
AVERAGE_WAIT_CSECS NUMBER
MAX_WAIT_CSECS NUMBER
TIME_WAITED_MICRO NUMBER
LOGOFF_TIMESTAMP DATE
17 rows selected
desc cc_sesstat_history;
Name Null Type
USERNAME VARCHAR2(30)
OSUSER VARCHAR2(30)
SID NUMBER
SERIAL# NUMBER
SESSION_PROCESS_ADDR RAW(0)
OS_CLIENT_PROCESS_ID VARCHAR2(24)
LOGON_TIME DATE
STATISTIC# NUMBER
NAME VARCHAR2(64)
VALUE NUMBER
LOGOFF_TIMESTAMP DATE
11 rows selectedI have taken out the 'commit' and have added the 'when others then null' exception clause, but I would imagine there is a better way to do it than this? I don't want to do an insert into another table either. With Oracle 11g, this gives me the compile time warning....
CREATE OR REPLACE TRIGGER cc_LogOff_Trig
BEFORE LogOff ON DATABASE
DECLARE
LogOff_sid PLS_INTEGER;
LogOff_Time DATE := SYSDATE;
Table_1 VARCHAR2(30) := 'CC_SESSION_EVENT_HISTORY';
Table_2 VARCHAR2(30) := 'CC_SESSTAT_HISTORY';
Table_Count NUMBER;
v_sql1 VARCHAR2(4000);
v_sql2 VARCHAR2(4000);
BEGIN
SELECT sId
INTO LogOff_sId
FROM sys.v$MysTat
WHERE ROWNUM < 2;
SELECT COUNT(* )
INTO Table_Count
FROM dba_Objects
WHERE Object_Name = Table_1
AND Object_Type = 'TABLE';
IF Table_Count = 1 THEN
v_sql1 := 'INSERT INTO bdev.cc_session_event_history(sid, serial#, username, osuser, session_process_addr, os_client_process_id, logon_time, type, event, total_waits, total_timeouts, time_waited_csecs,
average_wait_csecs, max_wait_csecs, logoff_timestamp) SELECT se.sid, s.serial#, s.username, s.osuser, s.paddr, s.process, s.logon_time, s.type, se.event, se.total_waits, se.total_timeouts, se.time_waited, se.average_wait,
se.max_wait, '''
||LogOff_Time
||''' FROM sys.v$session_event se, sys.v$session s WHERE se.sid = s.sid AND s.username = '''
||LogIn_User
||''' AND s.sid = '
||LogOff_sId;
EXECUTE IMMEDIATE v_sql1;
END IF;
SELECT COUNT(* )
INTO Table_Count
FROM dba_Objects
WHERE Object_Name = Table_2
AND Object_Type = 'TABLE';
IF Table_Count = 1 THEN
v_sql2 := 'INSERT INTO bdev.cc_sesstat_history(username, osuser, sid, serial#, session_process_addr, os_client_process_id, logon_time, statistic#, name, VALUE, logoff_timestamp) SELECT s.username,
s.osuser, ss.sid, s.serial#, s.paddr, s.process, s.logon_time, ss.statistic#, sn.name, ss.VALUE, '''
||LogOff_Time
||''' FROM sys.v$sesstat ss, sys.v$statname sn, sys.v$session s
WHERE ss.statistic# = sn.statistic# AND ss.sid = s.sid AND sn.name IN(''CPU used when call started'', ''CPU used by this session'', ''recursive cpu usage'', ''parse time cpu'')
AND s.username = '''
||Login_User
||''' AND s.sid = '
||LogOff_sId;
EXECUTE IMMEDIATE v_sql2;
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;Edited by: efachim on Jan 6, 2009 11:30 AM -
What's wrong with this small code?
hi, there,
I tried to compile the following code and get the error like:
Can't make static reference to non-static reference in line System.out.println(msg);
It is wired to me. Could somebody give a hint? Really appreciate!!!
Jianmin
import java.awt.*;
import java.awt.event.*;
public class fram extends Frame
String msg="hello";
public static void main(String arg[])
fram f=new fram();
Button b=new Button("Click");
b.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println(msg);
f.add(b);
f.pack();
f.show();Thanks a lot!!! it works.
msg is non-static, that is 'instance' variable,
and you can not acces it from static context. Simply
speaking you have to use b.msg, will not work
eather though -
I just got my new iPad Mini2, and when I choose "sign in with your apple ID", it says that "there was a problem connecting to the server". What's wrong with this, and how can I deal with this problem?
1. Turn router off for 30 seconds and on again
2. Settings>General>Reset>Reset Network Settings -
I can't figure out what's wrong with this code
First i want this program to allow me to enter a number with the EasyReader class and depending on the number entered it will show that specific line of this peom:
One two buckle your shoe
Three four shut the door
Five six pick up sticks
Seven eight lay them straight
Nine ten this is the end.
The error message i got was an illegal start of expression. I can't figure out why it is giving me this error because i have if (n = 1) || (n = 2) statements. My code is:
public class PoemSeventeen
public static void main(String[] args)
EasyReader console = new EasyReader();
System.out.println("Enter a number for the poem (0 to quit): ");
int n = console.readInt();
if (n = 1) || (n = 2)
System.out.println("One, two, buckle your shoe");
else if (n = 3) || (n = 4)
System.out.println("Three, four, shut the door");
else if (n = 5) || (n = 6)
System.out.println("Five, six, pick up sticks");
else if (n = 7) || (n = 8)
System.out.println("Seven, eight, lay them straight");
else if (n = 9) || (n = 10)
System.out.println("Nine, ten, this is the end");
else if (n = 0)
System.out.println("You may exit now");
else
System.out.println("Put in a number between 0 and 10");
I messed around with a few other thing because i had some weird errors before but now i have narrowed it down to just this 1 error.
The EasyReader class code:
// package com.skylit.io;
import java.io.*;
* @author Gary Litvin
* @version 1.2, 5/30/02
* Written as part of
* <i>Java Methods: An Introduction to Object-Oriented Programming</i>
* (Skylight Publishing 2001, ISBN 0-9654853-7-4)
* and
* <i>Java Methods AB: Data Structures</i>
* (Skylight Publishing 2003, ISBN 0-9654853-1-5)
* EasyReader provides simple methods for reading the console and
* for opening and reading text files. All exceptions are handled
* inside the class and are hidden from the user.
* <xmp>
* Example:
* =======
* EasyReader console = new EasyReader();
* System.out.print("Enter input file name: ");
* String fileName = console.readLine();
* EasyReader inFile = new EasyReader(fileName);
* if (inFile.bad())
* System.err.println("Can't open " + fileName);
* System.exit(1);
* String firstLine = inFile.readLine();
* if (!inFile.eof()) // or: if (firstLine != null)
* System.out.println("The first line is : " + firstLine);
* System.out.print("Enter the maximum number of integers to read: ");
* int maxCount = console.readInt();
* int k, count = 0;
* while (count < maxCount && !inFile.eof())
* k = inFile.readInt();
* if (!inFile.eof())
* // process or store this number
* count++;
* inFile.close(); // optional
* System.out.println(count + " numbers read");
* </xmp>
public class EasyReader
protected String myFileName;
protected BufferedReader myInFile;
protected int myErrorFlags = 0;
protected static final int OPENERROR = 0x0001;
protected static final int CLOSEERROR = 0x0002;
protected static final int READERROR = 0x0004;
protected static final int EOF = 0x0100;
* Constructor. Prepares console (System.in) for reading
public EasyReader()
myFileName = null;
myErrorFlags = 0;
myInFile = new BufferedReader(
new InputStreamReader(System.in), 128);
* Constructor. opens a file for reading
* @param fileName the name or pathname of the file
public EasyReader(String fileName)
myFileName = fileName;
myErrorFlags = 0;
try
myInFile = new BufferedReader(new FileReader(fileName), 1024);
catch (FileNotFoundException e)
myErrorFlags |= OPENERROR;
myFileName = null;
* Closes the file
public void close()
if (myFileName == null)
return;
try
myInFile.close();
catch (IOException e)
System.err.println("Error closing " + myFileName + "\n");
myErrorFlags |= CLOSEERROR;
* Checks the status of the file
* @return true if en error occurred opening or reading the file,
* false otherwise
public boolean bad()
return myErrorFlags != 0;
* Checks the EOF status of the file
* @return true if EOF was encountered in the previous read
* operation, false otherwise
public boolean eof()
return (myErrorFlags & EOF) != 0;
private boolean ready() throws IOException
return myFileName == null || myInFile.ready();
* Reads the next character from a file (any character including
* a space or a newline character).
* @return character read or <code>null</code> character
* (Unicode 0) if trying to read beyond the EOF
public char readChar()
char ch = '\u0000';
try
if (ready())
ch = (char)myInFile.read();
catch (IOException e)
if (myFileName != null)
System.err.println("Error reading " + myFileName + "\n");
myErrorFlags |= READERROR;
if (ch == '\u0000')
myErrorFlags |= EOF;
return ch;
* Reads from the current position in the file up to and including
* the next newline character. The newline character is thrown away
* @return the read string (excluding the newline character) or
* null if trying to read beyond the EOF
public String readLine()
String s = null;
try
s = myInFile.readLine();
catch (IOException e)
if (myFileName != null)
System.err.println("Error reading " + myFileName + "\n");
myErrorFlags |= READERROR;
if (s == null)
myErrorFlags |= EOF;
return s;
* Skips whitespace and reads the next word (a string of consecutive
* non-whitespace characters (up to but excluding the next space,
* newline, etc.)
* @return the read string or null if trying to read beyond the EOF
public String readWord()
StringBuffer buffer = new StringBuffer(128);
char ch = ' ';
int count = 0;
String s = null;
try
while (ready() && Character.isWhitespace(ch))
ch = (char)myInFile.read();
while (ready() && !Character.isWhitespace(ch))
count++;
buffer.append(ch);
myInFile.mark(1);
ch = (char)myInFile.read();
if (count > 0)
myInFile.reset();
s = buffer.toString();
else
myErrorFlags |= EOF;
catch (IOException e)
if (myFileName != null)
System.err.println("Error reading " + myFileName + "\n");
myErrorFlags |= READERROR;
return s;
* Reads the next integer (without validating its format)
* @return the integer read or 0 if trying to read beyond the EOF
public int readInt()
String s = readWord();
if (s != null)
return Integer.parseInt(s);
else
return 0;
* Reads the next double (without validating its format)
* @return the number read or 0 if trying to read beyond the EOF
public double readDouble()
String s = readWord();
if (s != null)
return Double.parseDouble(s);
// in Java 1, use: return Double.valueOf(s).doubleValue();
else
return 0.0;
Can anybody please tell me what's wrong with this code? ThanksString[] message = {
"One, two, buckle your shoe",
"One, two, buckle your shoe",
"Three, four, shut the door",
"Three, four, shut the door",
"Five, six, pick up sticks",
"Five, six, pick up sticks",
"Seven, eight, lay them straight",
"Seven, eight, lay them straight",
"Nine, ten, this is the end",
"Nine, ten, this is the end"
if(n>0)
System.out.println(message[n]);
else
System.exit(0);
Maybe you are looking for
-
Remove Header text from a sales order, created with reference to quotation
Hi all, I have a sales order(in VA01) which is created with reference to quotation (in VA21). If header text (Notes for logistics, Note for responsible person, Header text Doc & Declaration) in texts tab is maintained in the quotation they are gettin
-
Issues exporting out of lightroom 4
I've recently encounterd a problem while trying to export images out of Lightroom 4. I keep getting an error messge "File canot be written." This is happening whether I'm exporting a Jpeg or a raw file. Cannot figure what has happend but it's doi
-
Off the wall...
that's where my newly purchased "open box" UN65HU8700 came from.When I buy something for $2000+ I don't expect any problems when it is from BB.Great delivery,but delivery man could not turn on tv.After he left I played with the remote,replaced the de
-
How to start and stop server?
This is a design issue that may not belong in this forum, but bear with me, please. I have a stand-alone RMI server that I start thusly: public class StartServer { public static void main( String[] args ) AppContext context = Server.getCo
-
Hi, Please tell me Tcode for doing Setup of cash journal. Regards, Swetha