Need help with a Java-SQL connection
My classmates and I created a DesktopFrame. Within it are reports that require a connection to an MS Access Database. When a report in an InternalFrame is opened: the SQL command works, there is a connection, and everything goes well on the first run.
However, when another InternalFrame is opened or when the same InternalFrame is opened the 2nd time, an error occurs. It produces a java.sql.SQLException: General Error.
Can anyone help me? Thanks in advance.
Provide more info, maybe even some code segments. (Not all). May be easier to help
Similar Messages
-
Need Help with Formula using SQL maybe
I need help! I work with Crystal reports XI and usually manage just fine with the Formula editor but his one I think will require some SQL and I am not good at that.
We are running SQL 2000 I think (Enterprise Manager 8.0) Our sales people schedule activities and enter notes for customer accounts. Each is stored in a separate table. I need to find activities that are scheduled 240 days into the future and show the most recent note that goes with the account for which that activity is scheduled.
The two tables, Activities and History, share the an accountID field in common that links them to the correct customer account. I want to look at dates in the Startdate.Activities field more than 240 days in the future and show the most recent note from the History table where the accountid's match. I figure my query will contain a join on AccountID.Activities and AccountID.History used with Max(completedate.History) but I do not understand how to word it.
I would like to perform all this in crystal if possible. I humbly request your help.
MemberyYou SQL would look something like this...
SELECT
a.AccountID,
a.BlahBlahBlah, -- Any other fields you want from the Activities table
h.LastComment
FROM Activities AS a
LEFT OUTER JOIN History AS h ON a.AccountID = h.AccountID
WHERE (a.ActivityDate BETWEEN GetDate() AND DateAdd(dd, 240, GetDate()))
AND h.HistoryID IN (
SELECT MAX(HistoryID)
FROM History
GROUP BY AccountID)
This method assumes that the History table has a HistoryID that increments up automatically each time a new comment is added... So a comment made today would always have a higher HistoryID that one made yesterday.
If I'm wrong and there is no HistoryID or the HistoryID doesn't increment in a chronological fashion, it can still be done but the code is a bit more complex.
HTH,
Jason -
hi all, forgot i had a user name and password and haven't needed help for quite a bit since i didn't do sql for a while but now i'm back at reporting again...
Here is a sample table as i remember it:
Item Date Time Time Frame Duration Duration Frame
A 20100926 0 5 500 10
A 20100926 600 10 500 30
A 20100926 1500 12 100 30
B 20100926 1800 28 200 40
B 20100926 2200 6 150 70
B 20100926 2600 15 600 60
B 20100926 3600 30 200 70
Results Set (expected):
Item Date Time Total Duration
A 20100926 0 1600:20 --basically max (time+duration) - min(time+duration)
B 20100926 1800 2000:00
Sorry, but. I didnt put my sql statement as I wasn't planning on posting and left it at work, but, i've been looking on internet and people say to use min/max function and i've attenpted it with it works with just this table (without grouping). But as soon as i group it the values seem to mess up.
Last i remembered it gave me:
Item Date Time Total Duration
A 20100926 0 1600:30 --basically max(time+duration) - min(time+duration)
B 20100926 1800 2000:70
I think it's looking at max duration which is 30&70 and hence it retrurns those values in the result set. Is it because of the max function hence it's returning this value? any help is appreciated. thanks
Edited by: stanleyho on Sep 30, 2010 4:44 PMOkay, here we go again, repost, hopefully okay this time:
Hi Madhu, okay, just got to work: I am using TOAD and working in Oracle 10g. Here is my table structure and the query i use to try and get what I am looking for:
There is one extra table but that is only used to link these two tables listed below so i didn't bother posting it.
TABLE: TX_RECON_INSTANCE_VIEW
ColumnName ColID DataType Null
CHANNEL_CODE 3 VARCHAR2 (4 Char) N
DURATION 8 NUMBER (10) N
DURATION_FRAME 9 NUMBER (2) N
REAL_TIME 6 NUMBER (10) N
REAL_TIME_FRAME 7 NUMBER (2) N
ITEM_ID 4 NUMBER Y
TX_DATE 2 CHAR (8 Byte) N
TX_ID 1 NUMBER (9) N
TX_TYPE 13 VARCHAR2 (4 Char) N
TABLE: TX_SCHEDULE
ColumnName ColID PK Null DataType
TX_TYPE 22 N VARCHAR2 (4 Char)
TX_ID 1 1 N NUMBER (9)
TX_DATE 2 N CHAR (8 Byte)
SCHEDULE_TIME_FRAME 9 N NUMBER (2)
SCHEDULE_TIME 8 N NUMBER (10)
REAL_TIME 10 N NUMBER (10)
DURATION_FRAME 13 N NUMBER (2)
DURATION 12 N NUMBER (10)________________________________________
And the data and results:
TX_ID TX_DATE REAL_TIME REAL_TIME_FRAME DURATION DURATION_FRAME ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION SCHEDULE_TIME SCHEDULE_TIME_FRAME DURATION_1 DURATION_FRAME_1
1651000 20100710 0 0 545 20 1234 00:00:00:00 00:09:05:20 00:00:00:00 00:09:05:20 0 0 545 20
1752223 20100710 667 12 281 7 1234 00:11:07:12 00:04:41:07 00:11:07:10 00:04:41:07 667 10 281 7
1846501 20100710 1071 13 335 9 1234 00:17:51:13 00:05:35:09 00:17:50:09 00:05:35:09 1070 9 335 9
2001102 20100710 1525 6 249 14 1234 00:25:25:06 00:04:09:14 00:25:22:08 00:04:09:14 1522 8 249 14
3246669 20100710 1800 0 586 2 1235 00:30:00:00 00:09:46:02 00:30:00:00 00:09:46:02 1800 0 586 2
4456822 20100710 2492 16 276 5 1235 00:41:32:16 00:04:36:05 00:41:32:16 00:04:36:05 2492 16 276 5
1253168 20100710 2890 15 222 17 1235 00:48:10:15 00:03:42:17 00:48:10:15 00:03:42:17 2890 15 222 17
1112456 20100710 3277 18 297 0 1235 00:54:37:18 00:04:57:00 00:54:35:10 00:04:57:00 3275 10 297 0
Grouped results set:
TX_DATE ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION
20100710 1234 00:00:00:00 00:29:34:20 00:00:00:00 00:29:31:20
20100710 1235 00:30:00:00 00:29:34:17 00:30:00:00 00:29:32:17
--> SCHEDULED DURATION "00:29:31:20" is not correct as it should be (00:25:22:08+00:04:09:14)-(00:00:00:00)=00:29:31:22
--> see expected results below
Expected results:
TX_DATE ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION
20100710 1234 00:00:00:00 00:29:34:20 00:00:00:00 00:29:31:22
20100710 1235 00:30:00:00 00:29:34:18 00:30:00:00 00:29:34:10________________________________________
And the query I am using:
SELECT --TXR.TX_ID,
TXR.TX_DATE, TXR.ITEM_ID,
TO_CHAR(TRUNC((MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) )/3600),'FM00')||':'||TO_CHAR(TRUNC(MOD(MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,3600)/60),'FM00')||':'||TO_CHAR(MOD(MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00')||':'||TO_CHAR(MOD(MIN(TXR.REAL_TIME_FRAME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00') "AS RUN TIME",
to_char(trunc((MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME))/3600),'FM00')||':'||to_char(trunc(mod(MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME),3600)/60),'FM00')||':'||to_char(mod(MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME),60),'FM00')||':'||to_char(mod(MAX(TXR.REAL_TIME_FRAME+TXR.DURATION_FRAME)-MIN(TXR.REAL_TIME),60),'FM00') "AS RUN DURATION",
TO_CHAR(TRUNC((MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) )/3600),'FM00')||':'||TO_CHAR(TRUNC(MOD(MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,3600)/60),'FM00')||':'||TO_CHAR(MOD(MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00')||':'||TO_CHAR(MOD(MIN(TXS.SCHEDULE_TIME_FRAME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00') "SCHEDULED TIME",
to_char(trunc((MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME))/3600),'FM00')||':'||to_char(trunc(mod(MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME),3600)/60),'FM00')||':'||to_char(mod(MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME),60),'FM00')||':'||to_char(mod(MAX(TXS.DURATION_FRAME),60),'FM00') "SCHEDULED DURATION"
FROM TX_RECON_INSTANCE_VIEW TXR, TX_SCHEDULE TXS, TX_SCHEDULE_RECON TXREC
WHERE TXR.TX_DATE=20100926 AND TXR.TX_TYPE='P'
AND TXR.TX_ID=TXREC.RECON_TX_ID(+)
AND TXREC.BASE_TX_ID=TXS.TX_ID(+)
GROUP BY TXR.TX_DATE, TXR.ITEM_ID
ORDER BY TXR.TX_DATE, TXR.ITEM_ID, MAX(TXR.REAL_TIME)--does this work for everyone now? let me know...thanks -
Need help with error java.lang.IllegalArgumentException: timestamp on bar b
My company uses Java based applications for real time streaming stock market information and I have come across 2 users that are generating the same error:
Bar.addBar failed adding com.abwg.bar.BasicBar 20071210-08:27:00.000 104.34 104.35 104.25 104.25 950 to com.abwg.bar.BasicBar 20071210-09:30:00.000 104.11 104.38 104.11 104.38 436 :java.lang.IllegalArgumentException: timestamp on bar being combined older than original bar
I have had no luck trying to determine what the cause of this error is, however both users experience very laggy performance shortly after launching the application. I have not been able to duplicate the problem, and the developers have not been able to provide any response or possible causes yet.
I'd be very appreciative if anyone could help me make some sense of what this error type might mean. It's got something to do with the computer that the application is being run on. One user is on a Mac 10.3 using J2SE 1.4.2_12 and the other is on Win XP using Java 1.6_3Thank you Frank and Carole for your response. The stated issue/error is resolved. It had to do with the upgrade somehow which lead to multiple certs for the same agent. Anyway, I had to delete ADS and all attached Agents, re-create ADS, re-create all Agents and re-register with the new ADS. I then manually re-registered the Directory Server instances on both the Primary and Secondary Servers with the new ADS. Voila, the DSCC Web console no longer prompts for server credentials.
But importing the Wild card cert issue still remains. I added the issuing CA chain to the ldap instance CA store and I see the certs listed. But when I try to import the P12 cert/key combo, I get an error which says something like: "The certificate is already in the database". But it is not, verified using certutil.
Yes internal CA or Self-signed Certs are fine. If I add the internal CA and Root CA to the cert store on my LDAP clients, then I am fine. No SSL errors. But want to avoid using such as we do have quite a few clients which would be connecting to the store. Hence want to use our enterprise wild card Cert. I am not sure if it is an issue importing a wild card pkcs12 format.
As mentioned above I did add the CA chain (which issued the wild card) to the actual instance, not the ADS. I can try that. But are you sure we need to add the Root CA to Tomcat ks.
And while we are at it, the Self-signed certs generated using the Console is only valid for 2 years. Is it possible to change the term ?
Thanks again. -
Need Help with a JAVA programming assignment
How do I write a JAVA program that could be used as the start of an MS-DOS/Windows simulation of the IEEE 802.3 protocol? I am to only code the parts necessary to build the 802.3 frame. For the initial implementation, the Checksum function need not be a CRC function, and the Destination and Source addresses wil be in input, stored, and output, and in dotted-decimal format.
I need:
1. A record to describe the frame, with each field being a (byte-) string of the required size, except that the Data field is of variable size. Although the "Source address" and "Destination address" would be 6 bytes for a real implementation, for this first implementation you can either assume they'll be text strings in the usual "dotted decimal" form (e.g. "14.04.05.18.01.25" as a typical example--from Tanenbaum, p. 429), or 6 hex digits.
2. Suitable constant declarations for values such as the standard "Preamble" and "Start of Frame" values.
3. Suitable functions to Get the three variable values "Destination address", "Source address", and "Data" from the standard input device.
4. A suitable function to display each of the fields of a given frame in a format such as:
Preamble: ...
StartofFrame: ...
Destination: ...
etc.
5. A suitable function to generate a "Pad" field if necessary.
6. A "dummy" Checksum-generating function which just takes the first 32 bits (4 bytes) of the Data (or Data+Pad, if necessary) rather than an actual CRC algorithm.
I have no experience with Java. Can you help me or start me in the right direction?
Thanks...........TKIf you have no experience with Java, then it seems to me your first step should be to start learning the language. But it's difficult to advise how, since we don't know anything about your background. There are many good books available on Java, some are for beginners and some are for advanced programmers, so I'd suggest you go somewhere that has a large selection and start looking for something that doesn't seem completely over your head.
-
Need Help with Creating the SQl query
Hi,
SQL query gurus...
INFORMATION:
I have two table, CURRENT and PREVIOUS.(Table Defs below).
CURRENT:
Column1 - CURR_PARENT
Column2 - CURR_CHILD
Column3 - CURR_CHILD_ATTRIBUTE 1
Column4 - CURR_CHILD_ATTRIBUTE 2
Column5 - CURR_CHILD_ATTRIBUTE 3
PREVIOUS:
Column1 - PREV_PARENT
Column2 - PREV_CHILD
Column3 - PREV_CHILD_ATTRIBUTE 1
Column4 - PREV_CHILD_ATTRIBUTE 2
Column5 - PREV_CHILD_ATTRIBUTE 3
PROBLEM STATEMENT
Here the columns 3 to 5 are the attributes of the Child. Lets assume that I have two loads, One Today which goes to the CURRENT table and one yesterday which goes to the PREVIOUS table. Between these two loads there is a CHANGE in the value for Columns either 3/4/5 or all of them(doesnt matter if one or all).
I want to determine what properties for the child have changed with the help of a MOST efficient SQL query.(PARENT+CHILD is unique key). The Database is ofcourse ORACLE.
Please help.
Regards,
ParagHi,
The last message was not posted by the same user_name that started the thread.
Please don't do that: it's confusing.
Earlier replies give you the information you want, with one row of output (maximum) per row in current_tbl. There may be 1, 2 or 3 changes on a row.
You just have to unpivot that data to get one row for every change, like this:
WITH single_row AS
SELECT c.curr_parent
, c.curr_child
, c.curr_child_attribute1
, c.curr_child_attribute2
, c.curr_child_attribute3
, DECODE (c.curr_child_attribute1, p.prev_child_attribute1, 0, 1) AS diff1
, DECODE (c.curr_child_attribute2, p.prev_child_attribute2, 0, 2) AS diff2
, DECODE (c.curr_child_attribute3, p.prev_child_attribute3, 0, 3) AS diff3
FROM current_tbl c
JOIN previous_tbl p ON c.curr_parent = p.prev_parent
AND c.curr_child = p.prev_child
WHERE c.curr_child_attribute1 != p.prev_child_attribute1
OR c.curr_child_attribute2 != p.prev_child_attribute2
OR c.curr_child_attribute3 != p.prev_child_attribute3
, cntr AS
SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= 3
SELECT s.curr_parent AS parent
, s.curr_child AS child
, CASE c.n
WHEN 1 THEN s.curr_child_attribute1
WHEN 2 THEN s.curr_child_attribute2
WHEN 3 THEN s.curr_child_attribute3
END AS attribute
, c.n AS attribute_value
FROM single_row s
JOIN cntr c ON c.n IN ( s.diff1
, s.diff2
, s.diff3
ORDER BY attribute_value
, parent
, child
; -
I need help with a java assignment
I am being taught java but dont really understand what i have to do. If you send me an email to [email protected] ill send you a copy and so help me with the assignement.
I am currently working on free web page so you can download the assignment.
Thank You Allhey, there's something wrong with my internet, i clicked on your email adress and nothing happened :(
too bad. maybe i can't do your assignment.
go see somee tutorials, maybe these will help you, also try to understand how API will elp you (to both you may find links from left column of this page) and also, see if there area some samples of how to do what you need to be done.
http://www.javaalmanac.com -- my favorited place for code samples.
also whan you have some saaignment or other task, then see if google finds you apropriate solution. and there's a search function in these forums as well.
i hope you get your homework doen in time... -
Need help with basic Java programming
I'm having a little bit of trouble with my code. For the sake of argument, I've removed the code I'm having trouble with, because I know it was inaccurate. I'm trying to create a loop so that this program will keep going through and through until the user enters an invalid variable. I thought the default after the case statements was supposed to make the system exit and output my message. Those two problems, the loop and the default, are what I'm really having problems with. My code is posted below.
import javax.swing.JOptionPane;
import java.util.Locale;
import java.text.NumberFormat;
public class Retail
public static void main(String args[])
String firstNum;
String secondNum;
String result;
int prodNum; //first number to input
double quantity; //second number to input
double total = 0.0; //total of Prod * Quantity Sold for all items
// To use American Dollar
NumberFormat moneyFormat = NumberFormat.getCurrencyInstance( Locale.US );
// first number entered as string
firstNum = JOptionPane.showInputDialog( "Enter product number 1-5" );
// second number entered as string
secondNum = JOptionPane.showInputDialog( " Enter quantity of items sold" );
// convert values to type double or int from type string
prodNum = Integer.parseInt( firstNum );
quantity = Double.parseDouble( secondNum);
result="";
if ( prodNum >=1 && prodNum <=5 ) {
switch (prodNum)
case 1: // 1st product
total = 2.98 * quantity;
break;
case 2: // 2nd product
total = 4.50 * quantity;
break;
case 3: // 3rd product
total = 9.98 * quantity;
break;
case 4: //4th product
total = 4.49 * quantity;
break;
case 5:
total = 6.87 * quantity;
break;
default: JOptionPane.showMessageDialog( null, "Wrong product number entered" );
JOptionPane.showMessageDialog( null, moneyFormat.format(total), "Total Price of Items Purchased", JOptionPane.INFORMATION_MESSAGE );
System.exit(0);
***I know I need to put something in the user input message to state that any value other than 1-5 entered will cause the program to skip to the output, I'll put that in later.***When you post code, please use [code] and [/code] tags as described in Formatting Help on the message entry page. It makes it much easier to read and prevents accidental markup from array indices like [i].
-
Hey I'm trying to get a working understanding of some of the basics behind SQL, I've composed a few questions that I think may help me with this. Anyone that can help me with any of them will greatly help me thanks.
1. How to create synonym for tables?
2. How to describe the structure of tables?
3. How to list the contents of tables?
4. How to create a table named with the same structure as another table?
5. How to copy rows with less than a certain criteria in value (e.g. Price<$5.00) into another table?
6. How to change the data type to e.g. NUMBER(6)?
7. How to add a new column named with data type e.g. VARCHAR2(10)?
8. How to change a specific field within a table (e.g. For ORDER_NUMBER 12489, change the C_NUMBER to 315)?
9. How to delete a specific row from a table?
10. How to declare a column as the primary key of a table and call it e.g. PK_something?
11. How to show certain columns when another column is less than a certain criteria in value (e.g. Price<$5.00)?
12. How to show certain columns with another column having a certain item class e.g. HW or AP?
13. How to list certain columns when another column e.g. price is between two values?
14. How to list certain columns when another column e.g. price is negative?
15. How to use the IN operator to find certain columns (e.g. first and last name of customers who are serviced by a certain ID)
16. How to find certain columns when one of the columns begins with a particular letter (e.g. A)
18. How to list the contents of the a table sorted in ascending order of item class and, within each item class, sorted in descending order of e.g. price?
19. How to do a count of column in a table?
20. How to sum a column and make rename is something?
21. How to do a count of a column in a table (without repeats e.g. if a certain number repeats more than once than to only count it once)?
22. How to use a subquery to find certain fields in columns when the another column’s fields values are greater than e.g. its average price?848290 wrote:
Hey I'm trying to get a working understanding of some of the basics behind SQL, I've composed a few questions that I think may help me with this. Anyone that can help me with any of them will greatly help me thanks.To use the terminology you have in those questions, you must already have a basic understanding of SQL, so you have exposed yourself as not being the author of such questions.
Please do not ask homework questions without having at least attempted to answer them yourself first and show where you're struggling. -
Need Help With NetBeans (Java Studio Enterprise 8)'s code generation
Hi!
I am using Java Studio Enterprise 8 with NetBeans 4.1 IDE bundled together with it. When trying to create GUI out from NetBeans Form Designer, I don't like the way it generates the code. When I try to use a JTextField, it uses "Fully Qualifed Class Names" (e.g: javax.swing.JTextField) on the code. How do I set NetBeans not to use it but rather use only the class name and generate import lines on top of the code? Also, how do I set it up that it will generate the variable declarations (which is on the uneditable blue portion of the code) on top rather than the default which is placed at the bottom of the class code body. I have tried tweaking the Options menu of this IDE but haven't got any luck...
Hope you could help, and thanks in advance!To address the location of the var decl codegen section (or any codegen location issues), there is a workaround, admittedly, it is a bit tedious.
Once the form code is generated, as Kris mentioned, open the class in an external editor so that you can edit the generated code.
Then cut the entire var declaration section along with the begin/end gen-code markers and paste it to the section of the file you desire.
When you add more components to your form, the codegen will find this section wherever it is and add to it.
Alternatively, you could just move the non-protected code around the protected within the NB editor, but you would not be able to rearrange the order of the actual code-genned sections.
craig -
Need help with a java chat software!!! Anyone pls give ideas
I need to implement a chat protocol with sockets for my course!!
As of now i have only got to the simple client server application with sockets and have a user interface with panels.
How could I proceed...
How should i use login names and passwords??
Should i use if else loops to specify :
various headers like
login
pass
send
exit
if you could point out som esite that will be helpful or even a book it would be of great help!!Don't use if/else loops, they have this nasty habit of not existing.
My quarter-pence:
For passwords, use a map which maps name/hashed password. That way, you'll never actually store the password. -
Need Help with a Java programming exercise.
I have to Write a program that reads two times in military format (0900, 1730) and prints the number of hours and minutes between two times. Supply your own test program. Here are two sample runs. User inputs are the numbers.
Please enter the first time: 0900
Please enter the second time: 1730
8 hours 30 minutes
Please enter the first time: 1730
Please enter the second time: 0900
15 hours 30 minutes
Test Program I can write up myself. But the entire constructor I have no idea how to start. This is basic Java Coding. no C++ no importing anything.
So far this is what I got and I'm sure it's wrong:
public class TimeInterval
private double hours;
private double minutes;
public TimeInterval(double Time1, double Time2)
hours =
minutes =
}tad2382 wrote:
Jverd,
I'm guessing that in your early days on this forum you must have spent a lot of time explaining constructors, object creation, etc. Now, after some 40K posts to the forum, you figure newbies should just go and read the documentation. Is that what a lot of veteran posters feel?Perhaps the OP is not aware of the fact the Sun has a good deal of high quality study material published on their website. What's wrong with posting it in a thread? Why should one copy the same thing over and over again? If after reading that tutorial, the OP still has some questions about it, s/he is free to post a follow up question. I am sure that many of the regulars here are more than happy to answer them.
Also note that the OP's problem description is rather vague. A "I don't know where to start" is IMO best answered by a link to a comprehensive tutorial or a beginners book.
Being one of the (relatively) novice posters on the forum, I still feel the need to customize posts,Well, by all means: do so.
trying to see things from the poster's side. Maybe after a few thousand posts, I'll just keep throwing the same documentation at newbies, instead of detailed customized responses, heh.IMO, that's a load of cr@p. -
Need Help with a Java Question Plz
Hi
Could someone help me out with this please?
I need to know the difference between the two String methods equals and equalsIgnoreCase
ThanksThe former tests if the Strings are equal, the latter tests if they're equal, but ignores case...
I.e. "A".equalsIgnoreCase("a") returns true, among other things... -
Needed help with updating java code
Hello all,
Let me begin by let you know I am not a programmer and I have tried to solve this by reading on the net. I am a network admin so I tech knowledge but no programming.
I have a webcam sending a Jpg to an FTP site and there I have used an applet called view.class to refresh once a second.
site:http://70.154.170.253/webcamold.html
My problems is now that it refreshes the same image over and over. It refreshes the cached image not the new image.
From reading I suspect that it has to do with the newer version of java (it used to work fine).
I have tried using JavaCam but same issue it just refreshes cached image. Also image flickers, the applet I am trying to fix was really smooth.
I have also tried to compile code that I found on this forum but I got error dealing with deprecated code.
Any help would be greatly appreciated!!!
Code:
import java.applet.Applet;
import java.awt.*;
import java.io.PrintStream;
public class View extends Applet
implements Runnable
public void init()
setBackground(Color.white);
String s = getParameter("refresh");
if(s == null)
update = 30;
else
try
update = Integer.parseInt(s);
catch(Exception _ex)
update = 30;
filename = getParameter("picture");
if(filename == null)
System.out.println("No filename given as parameter.");
md = new MediaTracker(this);
off = createImage(size().width, size().height);
refreshImage();
public void paint(Graphics g)
g.drawImage(off, 0, 0, this);
public void update(Graphics g)
paint(g);
public void refreshImage()
img = getImage(getDocumentBase(), filename);
md.addImage(img, 0);
try
md.waitForID(0);
catch(Exception exception)
exception.printStackTrace();
Graphics g = off.getGraphics();
g.drawImage(img, 0, 0, this);
img.flush();
public void run()
while(th != null)
try
refreshImage();
repaint();
Thread.sleep(update * 1000);
catch(Exception exception)
System.out.println("Error when thread was supposed to sleep: " + exception.getMessage());
public void start()
if(th == null)
th = new Thread(this);
try
th.start();
return;
catch(Exception exception)
System.out.println("Couldn't start thread: " + exception.getMessage());
return;
} else
return;
public void stop()
if(th != null)
th.stop();
th = null;
public void destroy()
stop();
public View()
update = 30;
Thread th;
String filename;
int update;
Image img;
Image off;
MediaTracker md;This is compile error free code and regarding your issues i don't think am good at this stuff
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
public class View extends Applet implements Runnable {
Thread th;
String filename;
int update;
Image img;
Image off;
MediaTracker md;
public void init() {
setBackground(Color.white);
String s = getParameter("refresh");
if (s == null) {
update = 30;
} else {
try {
update = Integer.parseInt(s);
} catch (Exception _ex) {
update = 30;
filename = getParameter("picture");
if (filename == null) {
System.out.println("No filename given as parameter.");
md = new MediaTracker(this);
off = createImage(size().width, size().height);
refreshImage();
public void paint(Graphics g) {
g.drawImage(off, 0, 0, this);
public void update(Graphics g) {
paint(g);
public void refreshImage() {
img = getImage(getDocumentBase(), filename);
md.addImage(img, 0);
try {
md.waitForID(0);
} catch (Exception exception) {
exception.printStackTrace();
Graphics g = off.getGraphics();
g.drawImage(img, 0, 0, this);
img.flush();
public void run() {
while (th != null) {
try {
refreshImage();
repaint();
Thread.sleep(update * 1000);
} catch (Exception exception) {
System.out.println("Error when thread was supposed to sleep: "
+ exception.getMessage());
public void start() {
if (th == null) {
th = new Thread(this);
try {
th.start();
return;
} catch (Exception exception) {
System.out.println("Couldn't start thread: "
+ exception.getMessage());
return;
} else {
return;
public void stop() {
if (th != null) {
th.stop();
th = null;
public void destroy() {
stop();
public View() {
update = 30;
} -
Need help with this java thing
i got a script for virtual keyborad but i don't know much javascript
so need your help to fit this script to my htmldb application .
i have page with textare name P2_MESSAGE_DESC
i put the image near the textarea and i want the textarea to "get" what i type in the keyboard image.
here is the hava script :
<SCRIPT language=JavaScript>
//This var is changed on Unload from talkback to 'false' in order to not generate this onUnload
var DoUnload = true;
//var theInputName = opener.document.myform.inputName.value;
var theInputLength;
function doInsert(theChar) {
opener.document.myform(opener.document.myform.inputName.value).value += theChar;
function doDelete() {
theInputLength = opener.document.myform(opener.document.myform.inputName.value).value.length;
if(theInputLength > 0) {
if(opener.document.myform(opener.document.myform.inputName.value).value.substring(theInputLength-1,theInputLength)=="\n") {
opener.document.myform(opener.document.myform.inputName.value).value = opener.document.myform(opener.document.myform.inputName.value).value.substring(0,theInputLength-2);
} else {
opener.document.myform(opener.document.myform.inputName.value).value = opener.document.myform(opener.document.myform.inputName.value).value.substring(0,theInputLength-1);
function doSubmit() {
//opener.document.myform.submit();
window.close();
</SCRIPT>
<IMG height=159 src="#WORKSPACE_IMAGES#kbd.GIF" width=341 useMap=#HebMap border=0>
<MAP name=HebMap>
<AREA shape=RECT coords=272,94,297,120 href="javascript:doInsert('.')">
<AREA shape=RECT coords=246,94,271,120 href="javascript:doInsert('ץ')">
<AREA shape=RECT coords=220,94,245,120 href="javascript:doInsert('ת')">
<AREA shape=RECT coords=194,94,219,120 href="javascript:doInsert('צ')">
<AREA shape=RECT coords=168,94,193,120 href="javascript:doInsert('מ')">
<AREA shape=RECT coords=142,94,167,120 href="javascript:doInsert('נ')">
<AREA shape=RECT coords=116,94,141,120 href="javascript:doInsert('ה')">
<AREA shape=RECT coords=90,94,115,120 href="javascript:doInsert('ב')">
<AREA shape=RECT coords=64,94,89,120 href="javascript:doInsert('ס')">
<AREA shape=RECT coords=38,94,63,120 href="javascript:doInsert('ז')">
<AREA shape=RECT coords=286,67,311,93 href="javascript:doInsert(',')">
<AREA shape=RECT coords=260,67,285,93 href="javascript:doInsert('ף')">
<AREA shape=RECT coords=234,67,259,93 href="javascript:doInsert('ך')">
<AREA shape=RECT coords=208,67,233,93 href="javascript:doInsert('ל')">
<AREA shape=RECT coords=182,67,207,93 href="javascript:doInsert('ח')">
<AREA shape=RECT coords=156,67,181,93 href="javascript:doInsert('י')">
<AREA shape=RECT coords=130,67,155,93 href="javascript:doInsert('ע')">
<AREA shape=RECT coords=104,67,129,93 href="javascript:doInsert('כ')">
<AREA shape=RECT coords=78,67,103,93 href="javascript:doInsert('ג')">
<AREA shape=RECT coords=52,67,77,93 href="javascript:doInsert('ד')">
<AREA shape=RECT coords=26,67,51,93 href="javascript:doInsert('ש')">
<AREA shape=RECT coords=247,40,272,66 href="javascript:doInsert('פ')">
<AREA shape=RECT coords=221,40,246,66 href="javascript:doInsert('ם')">
<AREA shape=RECT coords=195,40,220,66 href="javascript:doInsert('ן')">
<AREA shape=RECT coords=169,40,194,66 href="javascript:doInsert('ו')">
<AREA shape=RECT coords=143,40,168,66 href="javascript:doInsert('ט')">
<AREA shape=RECT coords=117,40,142,66 href="javascript:doInsert('א')">
<AREA shape=RECT coords=91,40,116,66 href="javascript:doInsert('ר')">
<AREA shape=RECT coords=65,40,90,66 href="javascript:doInsert('ק')">
<AREA shape=RECT coords=39,40,64,66 href="javascript:doInsert('\'')">
<AREA shape=RECT coords=13,40,38,66 href="javascript:doInsert('/')">
<AREA shape=RECT coords=303,14,328,39 href="javascript:doInsert('0')">
<AREA shape=RECT coords=277,14,302,39 href="javascript:doInsert('9')">
<AREA shape=RECT coords=251,14,276,39 href="javascript:doInsert('8')">
<AREA shape=RECT coords=225,14,250,39 href="javascript:doInsert('7')">
<AREA shape=RECT coords=199,14,224,39 href="javascript:doInsert('6')">
<AREA shape=RECT coords=173,14,198,39 href="javascript:doInsert('5')">
<AREA shape=RECT coords=147,14,172,39 href="javascript:doInsert('4')">
<AREA shape=RECT coords=121,14,146,39 href="javascript:doInsert('3')">
<AREA shape=RECT coords=95,14,120,39 href="javascript:doInsert('2')">
<AREA shape=RECT coords=69,14,94,39 href="javascript:doInsert('1')">
<AREA shape=RECT coords=13,14,67,39 href="javascript:opener.nextField()">
<AREA shape=RECT coords=273,40,328,66 href="javascript:doDelete()">
<AREA shape=RECT coords=78,121,258,147 href="javascript:doInsert(' ')">
<AREA shape=RECT coords=272,121,327,147 href="javascript:doInsert('\n')">
</MAP>i just need to figure out the :
opener.document.myform(opener.document.myform.inputName.value).value += theChar;
how to change it to my p2_message_desc ?
thanksthanks carl ,
i changed it to:
document.getElementById('P2_MESSAGE_DESC').value += theChar;
and it put me the keyword in the textarea.
one problem left :-(
i want it to put the keyword where the cursor is for example
if i have this sentence in my textarea:
i love oracle htmldb application
and cursor is before htmldb word and i enter the word (push the virtual keyboard bottons):
develope
the sentence will be:
i love develope oracle htmldb application .
now if i do that i'm getting:
i love oracle htmldb application develope.
i hope you get my point.
thanks
Maybe you are looking for
-
Tired of this overheating problem - anyone have an answer???
hey all - i'm totally fed up with this problem i hope someone can suggest something new... i have the first gen macbook pro 17" 2.16 Core Duo (not C2D). over the last year it has had increasing problems with overheating... at a certain point the grap
-
Looking for a qualified Cocoa programmer
Hi all, I am looking for a qualified Cocoa programmer. The details regarding this job may be discussed further when an interested party contacts me at [email protected] Sincerely yours, Larry Message was edited by: UrsaSkoi
-
I updated from FF 8.0 to 8.0.1. I rebooted the PC. If I click "help>about" the response still shows 8.0, but the text beneath indicates that I'm up-to-date. What happened to my update? Using: XP Home Edition, Version 2002 with SP 3 on a HP Laptop. [e
-
Execute procedure with WebRowSet
I want to execute stored procedures created in a sql 2000 database using webrowset. I tried the following: 1. wrs.setCommand("proc1") 2. wrs.setCommang("exec proc1") both of them gave me the following error: java.sql.SQLException: [Microsoft][SQLServ
-
Badi implementation error after implementing oss note 745168
Hi All, i implemented oss note 745168 to fix badi ME_PROCESS_REQ_CUST by doing step 1 & 2 manually.. during the implementation of step 3, there was error but we just proceeded..now my whole badi consists error and can't be activated but the definitio