StreamTokenizer code: Don't understand.
Can anyone explain in dumbass language what is going on here? I mean, I know the end result, but I don't exactly understand what is going on. Little help?
char separator = ',';
StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new StringReader(str)));
tokenizer.resetSyntax();
tokenizer.wordChars('\u0000', (char)(separator -1)); // Everything is a word character.
tokenizer.wordChars((char)(separator + 1), '\u00ff'); // except for the separator.The first two lines are just there to give you a sense of context. :) My main problem is the three calls to the tokenizer methods. What on earth is going on there?
Thanks for any help. :)
char separator = ',';
StreamTokenizer tokenizer = new StreamTokenizer(new
BufferedReader(new StringReader(str)));
tokenizer.resetSyntax();All characters are "regular" for this tokenizer--none are considered "word" or "number" or "whitespace" characters.
tokenizer.wordChars('\u0000', (char)(separator -1));
// Everything is a word character. Everything from character 0 up to, but not including, the comma character is considered a "word" character.
tokenizer.wordChars((char)(separator + 1), '\u00ff');
// except for the separator.Everything after the comma, up to character 0x00ff is also a "word" character.The docs for StreamTokenizer say it can be used to break a stream up into words, numbers, comments, etc. We've defined that a comma is "ordindary" and everything else (up to char 255) is part of a word.
Similar Messages
-
I can't don't understand code in netbean and it's about Jframe.
i use netbean to design 2 jframe with some buttons on both frame.
frame1 is login form, frame2 is mainform. i want to show loginform then click the button1 to show 2nd jframe.
then i click exit on 2nd jframe and it come back to loginform(frame1).
i do alot of search on the google and here. i know the basic to show a jframe using
setVisible or .show() .hide(), etc..
the problem is what is my jframe variable name in netbean?
i know i can create an jframe object
such as: JFrame frame1 = new JFrame(); etc.. (it's ok if the syntax is wrong for now).
When i use netbean, i drag the Gui components to the Jframe. The jframe is generated by netbean automatically.
When the main program runs, it calls main() method, follow by :
public void run() {
new LoginForm().setVisible(true);
new LoginForm().setVisible <--- setVisible(true) means show the form.
and is new LoginForm() create an object from LoginForm class.
public LoginForm() {
initComponents();
When it create a new object, it runs default constructor and calls iniComponoents and finally show the jframe.
my question is when you create object, you usually declare variable and use variable to hold reference to the object.
that's why i don't understand how it works here.
it only create news object, bu no variable to holding it. how do i control this Jframe to show and hide without a reference variable????????????
Edited by: roadorange on Feb 29, 2008 10:08 PMroadorange wrote:
Encephalopathic . thank your reply so much. your reply is fast. i love it and love this forum.. LOLyou're welcome
i tried hand-written code, and it looks just fine when design few buttons, labels and textfields.
The adjustment of buttons(labels) are not that good on the frame.
However, when you use IDE, you can drag the button on any spot you like in the jframe.... and in the process not learn how Swing works, and lose flexibility and power. Sorry to sound conceited, but I'll match any of your netbeans-created GUI's with one of my own, and mine will likely be better -- and I'm not all that good at this just yet.
Much luck. -
Wrong codes? or maybe I don't understand the instructions
The instructions said "Write a procedure that will retrieve an
existing record in Enrollment usiing the student and section Ids
and set the grade to a specified value. (use update instead of
insert) and write another procedure that will assign a given
student a given advisor" I tried but cause I got a lot of
errors!!! any help would be appreciated just email me at
[email protected]. thanks!
create sequence room_seq increment by 1;
create sequence faculty_seq increment by 1;
create sequence student_seq increment by 1;
create sequence section_seq increment by 1;
create sequence enrollment_seq increment by 1;
create sequence room_section_seq increment by 1;
create table course(
courseNo varchar2(10),
name varchar2(30),
credits number,
constraint course_pk primary key (courseNo));
insert into course (courseNo, name, credits) values
('CIS405','ADVANCED DATABASE', 5);
insert into course (courseNo, name, credits) values
('CIS349','INTRO TO DATABASE', 5);
COMMIT;
create table room(
roomID number,
bldg char(1) check (bldg IN ('A','B')),
roomNo varchar2(10),
maxCapacity number,
style varchar2(15) check(style IN
('LECTURE','LECTURE/LAB','LAB','OFFICE')),
constraint room_pk primary key (roomID));
insert into room (roomID, bldg, roomNo, maxCapacity, style)
values (room_seq.nextval, 'B', '151A', 50, 'LAB');
insert into room (roomID, bldg, roomNo, maxCapacity, style)
values (room_seq.nextval, 'B', '151B', 50, 'LAB');
commit;
create table faculty(
facultyID number,
lname varchar2(30) not null,
fname varchar2(20) not null,
dept varchar2(5),
officeID number,
phone varchar2(15),
email varchar2(75),
rank char(4) check(rank IN ('INST','ASOC','ASST','FULL','SENR')),
constraint faculty_pk primary key (facultyID),
constraint faculty_fk foreign key (officeID) references room
(roomID));
insert into faculty(facultyID, lname, fname, dept, officeID,
phone, email, rank) values
(faculty_seq.nextval, 'CANNON', 'AMY', 'CIS',
6, '77052149003252', '[email protected]','FULL');
commit;
create table equipment(
equipmentID varchar2(30),
roomID number,
type varchar2(20) check(type IN('OVERHEAD PROJECTOR','PORTABLE
PROJECTOR','LAPTOP CONNECTION','DESKTOP COMPUTER','INTERNET
CONNECTION')),
constraint equipment_pk primary key (equipmentID),
constraint equipment_fk foreign key (roomID) references room
(roomID));
INSERT INTO EQUIPMENT (EQUIPMENTID, ROOMID, TYPE) VALUES ('111',
5, 'DESKTOP COMPUTER');
INSERT INTO EQUIPMENT (EQUIPMENTID, ROOMID, TYPE) VALUES ('222',
5, 'OVERHEAD PROJECTOR');
commit;
create table student(
stuID number,
lname varchar2(30),
fname varchar2(20),
street varchar2(100),
city varchar2(60),
state char(2),
zip varchar2(9),
major varchar2(5) check(major IN
('ACCT','ECT','EET','BIS','BSIT','CIS','TCOM')),
standing varchar2(10) check(standing IN
('FRESHMAN','SOPHOMORE','JUNIOR','SENIOR')),
gpa number(3,2),
advisor number,
constraint student_pk primary key (stuID),
constraint student_FK foreign key (advisor) references faculty
(facultyID));
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'SMITH', 'HEATHER', 'CIS', 'JUNIOR', 3.8,
2);
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'ELLIOTT', 'DAVE', 'CIS', 'JUNIOR', 3.65,
2);
commit;
create table section(
sectionID number,
sectionNo char(1),
courseNo varchar2(10),
facultyID number,
term char(4),
curSize number,
maxSize number,
constraint section_pk primary key (sectionID),
constraint section_course_fk foreign key (courseNo) references
course(courseNo),
constraint section_faculty_fk foreign key (facultyID) references
faculty(facultyID));
INSERT INTO SECTION (SECTIONID, SECTIONNO, COURSENO, FACULTYID,
TERM, CURSIZE, MAXSIZE)
VALUES (SECTION_SEQ.NEXTVAL, 'T', 'CIS405', 1, '1001', 17, 30);
INSERT INTO SECTION (SECTIONID, SECTIONNO, COURSENO, FACULTYID,
TERM, CURSIZE, MAXSIZE)
VALUES (SECTION_SEQ.NEXTVAL, 'G', 'CIS405', 2, '1001', 24, 30);
commit;
create table enrollment(
stuSectionID number,
stuID number,
sectionID number,
grade char(1) check(grade IN('A','B','C','D','F','I','W')),
constraint enrollment_pk primary key (stuSectionID),
constraint enrollment_stu_fk foreign key (stuID) references
student(stuID),
constraint enrollment_section_fk foreign key (sectionID)
references section(sectionID));
INSERT INTO ENROLLMENT (STUSECTIONID, STUID, SECTIONID) VALUES
(ENROLLMENT_SEQ.NEXTVAL, 3, 1);
INSERT INTO ENROLLMENT (STUSECTIONID, STUID, SECTIONID) VALUES
(ENROLLMENT_SEQ.NEXTVAL, 3, 8);
commit;
create table room_section(
roomSectionID number,
sectionID number,
roomID number,
day char(3) check(day IN
('MON','TUE','WED','THU','FRI','SAT','SUN')),
hour date,
term char(4),
constraint room_section_pk primary key (roomSectionID),
constraint room_section_section_fk foreign key (sectionID)
references section(sectionID),
constraint room_section_room_fk foreign key (roomID) references
room(roomID));
INSERT INTO ROOM_SECTION (ROOMSECTIONID, SECTIONID, ROOMID, DAY,
HOUR, TERM)
VALUES (ROOM_SECTION_SEQ.NEXTVAL, 1, 3, 'MON', TO_DATE('9:30
AM', 'HH:MI AM'), '1001');
INSERT INTO ROOM_SECTION (ROOMSECTIONID, SECTIONID, ROOMID, DAY,
HOUR, TERM)
VALUES (ROOM_SECTION_SEQ.NEXTVAL, 1, 3, 'MON', TO_DATE('10:30
AM', 'HH:MI AM'), '1001');
commit;
SQL> DESC ENROLLMENT
Name Null? Type
STUSECTIONID NOT NULL NUMBER
STUID NUMBER
SECTIONID NUMBER
GRADE CHAR(1)
SQL> CREATE OR REPLACE PROCEDURE Enrollment(
2 p_grade IN CHAR(1),
3 IS
4 v_stuid NUMBER,
5 v_sectionid NUMBER;
6 BEGIN
7 SELECT student_seq.NEXTVAL
8 INTO v_stuid
9 FROM DUAL;
10 UPDATE student
11 (stuid,
12 sectionid,
13 grade,
14 SET (v_stuid,
15 v_sectionid,
16 UPPER (p_grade),
17 COMMIT;
18 DBMS_OUTPUT.PUT_LINE ('Student added');
19 EXCEPTION
20 WHEN OTHERS THEN
21 DBMS_OUTPUT.PUT_LINE ('An error occurred');
22 END AddStudent;
23 /
I got those errors like above!!! I don't understand what the
instructions said. any assistance would be appreciated!David,
I am afraid that the
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE ('An error occurred');
was my fault. I had intended it as an example to provide only
minimal syntax where no exception handling whatsoever previously
existed. Beau is a student and I am trying to guide him in the
right direction without just writing all of it for him. In
fact, I am afraid I may have already provided too much code
without sufficient explanation. For you and others who may wish
to help, here are the e-mails that provide the background on how
we got to this point, with the most recent on top, starting with
the last resonse I sent to him:
Things that are wrong:
The instructions say to be sure to use the sequence number for
the student's ID, so you should not have p_stuID as an input
parameter. Instead you should create a variable and select the
student_seq.nextval into the variable from the dual table and
use that value to populate the stuid column.
Your input parameters should only have the variable type, not
the size, so just use varchar2 and number.
The check constraints only belong in the script that is used to
create the table, not in your procedure with your input
parameters, so remove them from the procedure.
The order and number of your columns you are inserting into and
values you are inserting must match, so if you insert into fname
then lname, you need to insert the values p_fname then p_lname.
You must either have first name then last name in both or last
name then first name in both, not one way in one and the other
way in the other.
The idea is that when you execute the procedure you specify the
values of the input parameter variable, then use those input
parameter variables to insert the values into the table. You
should not be specifying any specific values anywhere in your
procedure. In other words don't insert 'HEATHER', instead
insert fname, and so on.
You should only have one insert statement. Each time the
procedure is executed, a different set of values will be
provided, and the same insert statement will be used.
Additional suggestions:
Although it is not required, since IN is the default, it is
generally considered to be a good programming practice to use IN
with your input parameters. It just makes the code easier to
read and understand. As you write other code, you will learn to
use OUT for output parameters and IN OUT for parameters that are
both input and output parameters.
It is generally recommended to store all data in upper case,
that is capital letters, so that it is easier to index and
search and avoid duplicates and so on. In order to ensure that
your data is input in upper case, it is a good idea to use the
UPPER function.
Different programmers and companies have different standards
that they use for capitalization, indentation, spacing,
alignment, and so forth to make their code uniform and easier to
read. You may want to look at some various styles and see what
you like or ask what your instructor recommends.
You should add some sort of exception handling section. For
example, if someone attempts to insert a value for standing that
isn't acceptable, then the procedure will fail due to the
constraints and the student will not be added. You probably
want to display some sort of message to the user. You might
also want to display a message if the input is successful.
When you attempt to compile your program and you receive a
message that says "Warning: Procedure created with compilation
errors." or some such thing, then from the SQL> prompt, type
SHOW ERRORS and it will list the error message number, a brief
description of the problem, and the line of code that the
problem occurred on. You can then type LIST and it will list
the code with line numbers, so that you can tell what line
number the error message is referring to.
In the following example, I have fixed the things that were
wrong, formatted it the way I usually do, and added minimal
exception handling and messages. There is a lot more that you
could do. I have also demonstrated how the program can be
tested and the results of proper input and improper input. In
the example below, two students are added correctly, then an
attempt to add another fails because the standing is not valid
and violates a check constraint, because graduate is not
acceptable. After each execution of the procedure, I have
queried the table, so that you can see what was added and what
was not.
SQL> CREATE OR REPLACE PROCEDURE AddStudent
2 (p_fname IN VARCHAR2,
3 p_lname IN VARCHAR2,
4 p_major IN VARCHAR2,
5 p_standing IN VARCHAR2,
6 p_gpa IN NUMBER)
7 IS
8 v_stuid NUMBER;
9 BEGIN
10 SELECT student_seq.NEXTVAL
11 INTO v_stuid
12 FROM DUAL;
13
14 INSERT INTO student
15 (stuid,
16 fname,
17 lname,
18 major,
19 standing,
20 gpa)
21 VALUES (v_stuid,
22 UPPER (p_fname),
23 UPPER (p_lname),
24 UPPER (p_major),
25 UPPER (p_standing),
26 p_gpa);
27
28 COMMIT;
29 DBMS_OUTPUT.PUT_LINE ('Student added');
30 EXCEPTION
31 WHEN OTHERS THEN
32 DBMS_OUTPUT.PUT_LINE ('An error occurred');
33 END AddStudent;
34 /
Procedure created.
SQL> COLUMN fname FORMAT A15
SQL> COLUMN lname FORMAT A15
SQL> SELECT stuid, fname, lname, major, standing, gpa
2 FROM student
3 /
no rows selected
SQL> SET SERVEROUTPUT ON
SQL> EXEC AddStudent ('HEATHER', 'SMITH', 'CIS', 'JUNIOR', 3.8)
Student added
PL/SQL procedure successfully completed.
SQL> SELECT stuid, fname, lname, major, standing, gpa
2 FROM student
3 /
STUID FNAME LNAME MAJOR
STANDING GPA
1 HEATHER SMITH CIS
JUNIOR 3.8
SQL> EXEC AddStudent ('Dave', 'Elliott', 'CIS', 'junior', 3.65)
Student added
PL/SQL procedure successfully completed.
SQL> SELECT stuid, fname, lname, major, standing, gpa
2 FROM student
3 /
STUID FNAME LNAME MAJOR
STANDING GPA
1 HEATHER SMITH CIS
JUNIOR 3.8
2 DAVE ELLIOTT CIS
JUNIOR 3.65
SQL> EXEC AddStudent ('KARL', 'WEBSTER', 'CIS', 'GRADUATE', 3.2)
An error occurred
PL/SQL procedure successfully completed.
SQL> SELECT stuid, fname, lname, major, standing, gpa
2 FROM student
3 /
STUID FNAME LNAME MAJOR
STANDING GPA
1 HEATHER SMITH CIS
JUNIOR 3.8
2 DAVE ELLIOTT CIS
JUNIOR 3.65
SQL>
I am going home now. Sometimes I get a chance to respond to my
e-mail daily and sometimes I may not get to it for a week. It
is better if you post your questions on one of the forums where
you may get more rapid responses from many people. I have
provided links to some forums that I browse below. If you have
internet access, you should be able to just click on them. Some
may require you to register, but they are all free.
The following is a link to the Oracle Technology Network forums,
hosted by Oracle Corporation, where I recommend the SQL and
PL/SQL discussions.
http://forums.oracle.com/forums/homepage.jsp
The following is a link to the PL/SQL forums of the REVEALNET
site, where noted author Steven Feuerstein is one of the SYSOPS,
where, for you, I recommend the "Beginner PL/SQL Developer
Questions" discussions.
http://PIPETALK.REVEALNET.COM/~PLSQL/LOGIN
The following is a link to another forum, where I recommend the
RDBMS, SQL, PL/SQL discussions.
http://www.orafans.com/cgi-bin/orafans/ubb/Ultimate.cgi?
action=intro
I would still like to know where you got my e-mail address, what
class you are taking, who your instructor is, and so forth.
Please do let me know.
Good luck,
Barbara
-----Original Message-----
From: bseo.ga [SMTP:[email protected]]
Sent: Wednesday, December 19, 2001 12:19 AM
To: Boehmer, Barbara A.
Subject: Re: PL/SQL
Importance: High
what is wrong with the compilation errors?
CREATE or REPLACE PROCEDURE AddStudent(
p_stuID number,
p_lname varchar2(30),
p_fname varchar2(20),
p_major varchar2(5) check(major IN
('ACCT','ECT','EET','BIS','BSIT','CIS','TCOM')),
P_standing varchar2(10) check(standing IN
('FRESHMAN','SOPHOMORE','JUNIOR','SENIOR')),
P_gpa number(3,2) IS
BEGIN
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'SMITH', 'HEATHER', 'CIS', 'JUNIOR', 3.8,
2);
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'ELLIOTT', 'DAVE', 'CIS', 'JUNIOR', 3.65,
2);
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'WEBSTER', 'KARL', 'CIS', 'SENIOR', 3.2,
2);
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'COX', 'STACEY', 'CIS', 'SENIOR', 2.7, 1);
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'HOWARD', 'BRIAN', 'CIS', 'JUNIOR', 3.18,
1);
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'DENNIS', 'KELLY', 'CIS', 'SENIOR', 4.0,
1);
COMMIT;
END;
SQL> /
Warning: Procedure created with compilation errors.
----- Original Message -----
From: Boehmer, Barbara A. <mailto:[email protected]>
To: 'bseo.ga' <mailto:[email protected]>
Sent: Tuesday, December 18, 2001 5:17 PM
Subject: RE: PL/SQL
I am not sure what part of it you don't understand.
The first section that you included is a script that you need to
copy and run, in order to create the sequences, tables, and data
that you will need to complete your assignment. You will need
to edit an empty .sql file, copy the script into the file, save
the file, then start the file. For example:
SQL> EDIT test
Type or copy the script and save the file.
SQL> START test
You should see various messages as the items are created. Then
you can use the following commands to see the tables and
sequences that you have created:
SQL> SELECT table_name FROM user_tables;
SQL> SELECT sequence_name FROM user_sequences;
To show the structure of an individual table, for example the
course table:
SQL> DESC course
To show the data in an individual table, like the course table:
SQL> SELECT * FROM course;
In the second section that you have provided, your instructor is
asking you to create three different procedures to do three
different things. To create a procedure, you edit a .sql file,
type the code to create the procedure, save the file, then start
the file. I usually make the .sql file name the same as the
procedure name. So, for example, in number 1, you are asked to
create a procedure named AddStudent, so you would:
SQL> EDIT AddStudent
Type your code.
Save the file.
SQL> START AddStudent
You should receive a message that says:
Procedure created.
Then, to execute your procedure:
SQL> EXEC AddStudent (put your parameter values here)
The basic syntax for creating a pl/sql procedure is:
CREATE OR REPLACE PROCEDURE procedure_name
(put your parameters here)
AS
put your variable declarations here;
BEGIN
put your code that you want to execute here,
like insert statements and update statements;
END procedure_name;
So, if you are trying to create a procedure to add a new student
(which means inserting a row into the student table), you will
need to accept the values (parameters) that you are going to
insert, then insert them:
CREATE OR REPLACE PROCEDURE AddStudent
(p_first .....
p_last .....
p_major .....
p_standing .....
p_GPA .....)
AS
BEGIN
INSERT INTO student .....;
END AddStudent;
I have just given you a starting format and deliberately left
out a lot, because you will learn more by doing it yourself. I
hope that makes things a little clearer.
I would like to know a little more about the class you are
taking. Please let me know where you are going to school, who
your instructor is, what is the name of the class you are
taking, and what book are you using. Also, please let me know
where you got my e-mail address (from one of the forums?)
Good luck,
Barbara
-----Original Message-----
From: bseo.ga [mailto:[email protected]]
Sent: Tuesday, December 18, 2001 5:57 PM
To: [email protected]
Subject: PL/SQL
Importance: High
I don't understand reading the following instructions from my
professor and the books. help would be apppreciated.
-------------create the sequence numbers needed to generate
primary key values
create sequence room_seq increment by 1;
create sequence faculty_seq increment by 1;
create sequence student_seq increment by 1;
create sequence section_seq increment by 1;
create sequence enrollment_seq increment by 1;
create sequence room_section_seq increment by 1;
create table course(
courseNo varchar2(10),
name varchar2(30),
credits number,
constraint course_pk primary key (courseNo));
insert into course (courseNo, name, credits) values
('CIS405','ADVANCED DATABASE', 5);
insert into course (courseNo, name, credits) values
('CIS349','INTRO TO DATABASE', 5);
COMMIT;
create table room(
roomID number,
bldg char(1) check (bldg IN ('A','B')),
roomNo varchar2(10),
maxCapacity number,
style varchar2(15) check(style IN
('LECTURE','LECTURE/LAB','LAB','OFFICE')),
constraint room_pk primary key (roomID));
insert into room (roomID, bldg, roomNo, maxCapacity, style)
values (room_seq.nextval, 'B', '151A', 50, 'LAB');
insert into room (roomID, bldg, roomNo, maxCapacity, style)
values (room_seq.nextval, 'B', '151B', 50, 'LAB');
commit;
create table faculty(
facultyID number,
lname varchar2(30) not null,
fname varchar2(20) not null,
dept varchar2(5),
officeID number,
phone varchar2(15),
email varchar2(75),
rank char(4) check(rank IN
('INST','ASOC','ASST','FULL','SENR')),
constraint faculty_pk primary key (facultyID),
constraint faculty_fk foreign key (officeID) references room
(roomID));
insert into faculty(facultyID, lname, fname, dept, officeID,
phone, email, rank) values
(faculty_seq.nextval, 'CANNON', 'AMY', 'CIS',
6, '77052149003252', '[email protected]','FULL'
<mailto:'[email protected]','FULL'>);
commit;
create table equipment(
equipmentID varchar2(30),
roomID number,
type varchar2(20) check(type IN('OVERHEAD PROJECTOR','PORTABLE
PROJECTOR','LAPTOP CONNECTION','DESKTOP COMPUTER','INTERNET
CONNECTION')),
constraint equipment_pk primary key (equipmentID),
constraint equipment_fk foreign key (roomID) references room
(roomID));
INSERT INTO EQUIPMENT (EQUIPMENTID, ROOMID, TYPE) VALUES ('111',
5, 'DESKTOP COMPUTER');
INSERT INTO EQUIPMENT (EQUIPMENTID, ROOMID, TYPE) VALUES ('222',
5, 'OVERHEAD PROJECTOR');
commit;
create table student(
stuID number,
lname varchar2(30),
fname varchar2(20),
street varchar2(100),
city varchar2(60),
state char(2),
zip varchar2(9),
major varchar2(5) check(major IN
('ACCT','ECT','EET','BIS','BSIT','CIS','TCOM')),
standing varchar2(10) check(standing IN
('FRESHMAN','SOPHOMORE','JUNIOR','SENIOR')),
gpa number(3,2),
advisor number,
constraint student_pk primary key (stuID),
constraint student_FK foreign key (advisor) references faculty
(facultyID));
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'SMITH', 'HEATHER', 'CIS', 'JUNIOR', 3.8,
2);
INSERT INTO STUDENT (STUID, LNAME, FNAME, MAJOR, STANDING, GPA,
ADVISOR) VALUES
(STUDENT_SEQ.NEXTVAL, 'ELLIOTT', 'DAVE', 'CIS', 'JUNIOR', 3.65,
2);
commit;
create table section(
sectionID number,
sectionNo char(1),
courseNo varchar2(10),
facultyID number,
term char(4),
curSize number,
maxSize number,
constraint section_pk primary key (sectionID),
constraint section_course_fk foreign key (courseNo) references
course(courseNo),
constraint section_faculty_fk foreign key (facultyID)
references faculty(facultyID));
INSERT INTO SECTION (SECTIONID, SECTIONNO, COURSENO, FACULTYID,
TERM, CURSIZE, MAXSIZE)
VALUES (SECTION_SEQ.NEXTVAL, 'T', 'CIS405', 1, '1001', 17, 30);
INSERT INTO SECTION (SECTIONID, SECTIONNO, COURSENO, FACULTYID,
TERM, CURSIZE, MAXSIZE)
VALUES (SECTION_SEQ.NEXTVAL, 'G', 'CIS405', 2, '1001', 24, 30);
commit;
create table enrollment(
stuSectionID number,
stuID number,
sectionID number,
grade char(1) check(grade IN('A','B','C','D','F','I','W')),
constraint enrollment_pk primary key (stuSectionID),
constraint enrollment_stu_fk foreign key (stuID) references
student(stuID),
constraint enrollment_section_fk foreign key (sectionID)
references section(sectionID));
INSERT INTO ENROLLMENT (STUSECTIONID, STUID, SECTIONID) VALUES
(ENROLLMENT_SEQ.NEXTVAL, 3, 1);
INSERT INTO ENROLLMENT (STUSECTIONID, STUID, SECTIONID) VALUES
(ENROLLMENT_SEQ.NEXTVAL, 3, 8);
commit;
create table room_section(
roomSectionID number,
sectionID number,
roomID number,
day char(3) check(day IN
('MON','TUE','WED','THU','FRI','SAT','SUN')),
hour date,
term char(4),
constraint room_section_pk primary key (roomSectionID),
constraint room_section_section_fk foreign key (sectionID)
references section(sectionID),
constraint room_section_room_fk foreign key (roomID)
references room(roomID));
INSERT INTO ROOM_SECTION (ROOMSECTIONID, SECTIONID, ROOMID, DAY,
HOUR, TERM)
VALUES (ROOM_SECTION_SEQ.NEXTVAL, 1, 3, 'MON', TO_DATE('9:30
AM', 'HH:MI AM'), '1001');
INSERT INTO ROOM_SECTION (ROOMSECTIONID, SECTIONID, ROOMID, DAY,
HOUR, TERM)
VALUES (ROOM_SECTION_SEQ.NEXTVAL, 1, 3, 'MON', TO_DATE('10:30
AM', 'HH:MI AM'), '1001');
commit;
The lab notes from my professor said
1. your system will often need to create a new student. Write
PL/SQL code for an object named AddStudent that will take values
for first and last name, major, standing and GPA and add a new
record in the Student table. Since advisors aren't assigned at
registration time, we'll add their advisor at a later date.
Don't worry about the student's address. Be sure to use the
sequence number for the student's ID.
2. Write a procedure that will retrieve an existing record in
Enrollment usiing the student and section Ids and set the grade
to a specified value. (use update instead of insert)
3. Write another procedure that will assign a given student a
given advisor. -
I purchased the teacher and student lightroom 5. I put in my code and uploaded my evidence to show that I am a teacher. I am guessing it was sent through to someone. How do I know when I can use the software? I don't understand what to do next.
Please refer below link for more information
Education FAQ -
I keep getting this error message when I (right-click) on a photo file on my desktop to burn to a CD. I don't understand this code...does anyone? Thanks Ariel**: The disc can’t be burned because an unexpected error occurred (error code 0x80020000).
I tried every obvious solution to this problem with different types of disc (-R; +R; -RW and +RW) and the problem persisted. Then I read about removing a hyphen in picture filenames. I renamed all the images and bingo there were no further problems. Apple should have solved this by now. This error code has been reported for several years and my MacBook Pro is quite new. Anyway, I hope this helps. It does work.
Piggywiggle -
Ok I know that the code below is a sql statement that is created as a string in a java program. What I don't understand is what the bolded portion is doing. I know that the + stands for concat in most case but I don't understand its purpose below. These items are declared as private strings what does that have to do with it?
String sql = "select stddev_samp(enteredvalue) as stddev from (" +
" select enteredvalue, " +
" row_number() over (order by m1.u_calc_no desc) AS rowcount " +
" from sdidataitem sd, s_sample s1, s_sample s2, u_melt m1, u_melt m2 "+
" where s1.s_sampleid=sd.keyid1 " +
" and sd.sdcid='Sample' " +
" and s1.sampletypeid='" + sampletype + "' " +
" and s1.samplestatus in ('Approved','Reported','Completed') " +
" and sd.paramid='" + strIParamid + "' " +
" and sd.paramtype='" + paramtype + "' " +
" and sd.enteredvalue is not null " +
" and s1.s_sampleid <> s2.s_sampleid " +
" and s2.s_sampleid = '" + sampleid + "' " +
" and s1.u_meltid = m1.u_meltid " +
" and s2.u_meltid = m2.u_meltid " +
" and m1.u_alloy_codeid = m2.u_alloy_codeid " +
" and m1.u_calc_no < m2.u_calc_no " +
" ) where rowcount<=50";+
Message was edited by:
Egyptgirl18If you were to rewrite the sql with proper indentation as shown below,
what the sql statement is doing will be clearer for you.
String sql =
"select "+
"stddev_samp(enteredvalue) as stddev "+
"from ( " +
"select "+
"enteredvalue, " +
"row_number() over (order by m1.u_calc_no desc) AS
rowcount " +
"from "+
"sdidataitem sd, "+
"s_sample s1, "+
"s_sample s2, "+
"u_melt m1, "+
"u_melt m2 "+
"where "+
"s1.s_sampleid=sd.keyid1 and " +
"sd.sdcid='Sample' and " +
"s1.sampletypeid=" +"'" + sampletype +"'"+ " and " +
"s1.samplestatus in ('Approved','Reported','Completed') and " +
"sd.paramid='" + strIParamid + "' and " +
"sd.paramtype='" + paramtype + "' and " +
"sd.enteredvalue is not null and" +
"s1.s_sampleid <> s2.s_sampleid and " +
"s2.s_sampleid =" + "'" + sampleid + "'" + " and " +
"s1.u_meltid = m1.u_meltid and " +
"s2.u_meltid = m2.u_meltid and " +
"m1.u_alloy_codeid = m2.u_alloy_codeid and " +
"m1.u_calc_no < m2.u_calc_no " +
") "+
"where "+
"rowcount<=50 "; -
Hi,
Ok, I'll preface this by saying there's a lotta code pasted in here but it really quite an easy question, I just need to post all the code so you understand where what came from.
Now.............the question I'm trying to do is to create an applet that has 2 buttons -- each button when clicked opens an application (one is a simple calculator, the other a Mortgage calculation app). When you click one of the buttons (calc or mortgage), that app opens infront of the 2 button menu so its in "focus". The button on the 2 button menu then switches to a "hide app X" button (ie: "Mortgage", changes to "Hide Mortgage"). Thus if you click the hide button, the app that was opened is hidden, and then that "hide" button switches back to the original "app X" button. Pretty simple.
Now, I have from my text book an example that does exactly this, with the simple calculator already in it, and with another app (a traffic light thing) where the Mortgage should be in my final product. I also already have the Mortgage applet I need to insert from another book example in place of that Traffic Light portion.
Now, common sense would dictate that I should be able to just copy my code for the Mortgage applet into the example that has the 2 button menu structure, and overwrite the code I want to get rid of (the traffic light) with the mortgage code & rename the menu buttons. Right?? A simple switch of one thing for another... but therein lies my problem.
I copied all the Mortgage code in correctly over the traffic lights, switched the button names, tried to compile it but I get one error....
Exercise12_17.java:52: cannot resolve symbol
symbol : method pack ()
location: class MortgageApplet
mortgageAppletFrame.pack();I don't understand why..... mortgageAppletFrame.pack(); was a simple rewrite from lightsFrame.pack(); like every other line...... it should work. I've gone over it for 2 days......... Anyone know why it comes up as an error???
Below, in order going down is (1)my code with the 1 error I can't solve, (2)the original menu example I tried to edit, and (3)the Mortgage app code...........
Does anyone know what my error is?? Help or a hint would be greatly appreciated........ Thanks.
My erroring app.......
// Exercise12_17.java: Create multiple windows
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.TitledBorder;
public class Exercise12_17 extends JFrame implements ActionListener {
// Declare and create a frame: an instance of MenuDemo
MenuDemo calcFrame = new MenuDemo();
// Declare and create a frame: an instance of RadioButtonDemo
MortgageApplet mortgageAppletFrame = new MortgageApplet();
// Declare two buttons for displaying frames
private JButton jbtCalc;
private JButton jbtMortgage;
public static void main(String[] args) {
Exercise12_17 frame = new Exercise12_17();
frame.setSize( 400, 70 );
frame.setTitle("Exercise 11.8: Multiple Windows Demo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
public Exercise12_17() {
// Add buttons to the main frame
getContentPane().setLayout(new FlowLayout());
getContentPane().add(jbtCalc = new JButton("Simple Calculator"));
getContentPane().add(jbtMortgage = new JButton("Mortgage"));
// Register the main frame as listener for the buttons
jbtCalc.addActionListener(this);
jbtMortgage.addActionListener(this);
public void actionPerformed(ActionEvent e) {
String arg = e.getActionCommand();
if (e.getSource() instanceof JButton)
if ("Simple Calculator".equals(arg)) {
//show the MenuDemo frame
jbtCalc.setText("Hide Simple Calculator");
calcFrame.pack();
calcFrame.setVisible(true);
else if ("Hide Simple Calculator".equals(arg)) {
calcFrame.setVisible(false);
jbtCalc.setText("Simple Calculator");
else if ("Mortgage".equals(arg)) {
//show the CheckboxGroup frame
mortgageAppletFrame.pack();
jbtMortgage.setText("Hide Mortgage");
mortgageAppletFrame.setVisible(true);
else if ("Hide Mortgage".equals(arg)) {
mortgageAppletFrame.setVisible(false);
jbtMortgage.setText("Mortgage");
class MortgageApplet extends JApplet
implements ActionListener {
// Declare and create text fields for interest rate
// year, loan amount, monthly payment, and total payment
private JTextField jtfAnnualInterestRate = new JTextField();
private JTextField jtfNumOfYears = new JTextField();
private JTextField jtfLoanAmount = new JTextField();
private JTextField jtfMonthlyPayment = new JTextField();
private JTextField jtfTotalPayment = new JTextField();
// Declare and create a Compute Mortgage button
private JButton jbtComputeMortgage = new JButton("Compute Mortgage");
/** Initialize user interface */
public void init() {
// Set properties on the text fields
jtfMonthlyPayment.setEditable(false);
jtfTotalPayment.setEditable(false);
// Right align text fields
jtfAnnualInterestRate.setHorizontalAlignment(JTextField.RIGHT);
jtfNumOfYears.setHorizontalAlignment(JTextField.RIGHT);
jtfLoanAmount.setHorizontalAlignment(JTextField.RIGHT);
jtfMonthlyPayment.setHorizontalAlignment(JTextField.RIGHT);
jtfTotalPayment.setHorizontalAlignment(JTextField.RIGHT);
// Panel p1 to hold labels and text fields
JPanel p1 = new JPanel();
p1.setLayout(new GridLayout(5, 2));
p1.add(new Label("Annual Interest Rate"));
p1.add(jtfAnnualInterestRate);
p1.add(new Label("Number of Years"));
p1.add(jtfNumOfYears);
p1.add(new Label("Loan Amount"));
p1.add(jtfLoanAmount);
p1.add(new Label("Monthly Payment"));
p1.add(jtfMonthlyPayment);
p1.add(new Label("Total Payment"));
p1.add(jtfTotalPayment);
p1.setBorder(new
TitledBorder("Enter interest rate, year and loan amount"));
// Panel p2 to hold the button
JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout(FlowLayout.RIGHT));
p2.add(jbtComputeMortgage);
// Add the components to the applet
getContentPane().add(p1, BorderLayout.CENTER);
getContentPane().add(p2, BorderLayout.SOUTH);
// Register listener
jbtComputeMortgage.addActionListener(this);
/** Handle the "Compute Mortgage" button */
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jbtComputeMortgage) {
// Get values from text fields
double interest = (Double.valueOf(
jtfAnnualInterestRate.getText())).doubleValue();
int year =
(Integer.valueOf(jtfNumOfYears.getText())).intValue();
double loan =
(Double.valueOf(jtfLoanAmount.getText())).doubleValue();
// Create a mortgage object
Mortgage m = new Mortgage(interest, year, loan);
// Display monthly payment and total payment
jtfMonthlyPayment.setText(String.valueOf(m.monthlyPayment()));
jtfTotalPayment.setText(String.valueOf(m.totalPayment()));
class MenuDemo extends JFrame implements ActionListener {
// Text fields for Number 1, Number 2, and Result
private JTextField jtfNum1, jtfNum2, jtfResult;
// Buttons "Add", "Subtract", "Multiply" and "Divide"
private JButton jbtAdd, jbtSub, jbtMul, jbtDiv;
// Menu items "Add", "Subtract", "Multiply","Divide" and "Close"
private JMenuItem jmiAdd, jmiSub, jmiMul, jmiDiv, jmiClose;
/** Main method */
public static void main(String[] args) {
MenuDemo frame = new MenuDemo();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
/** Default constructor */
public MenuDemo() {
setTitle("Menu Demo");
// Create menu bar
JMenuBar jmb = new JMenuBar();
// Set menu bar to the frame
setJMenuBar(jmb);
// Add menu "Operation" to menu bar
JMenu operationMenu = new JMenu("Operation");
operationMenu.setMnemonic('O');
jmb.add(operationMenu);
// Add menu "Exit" in menu bar
JMenu exitMenu = new JMenu("Exit");
exitMenu.setMnemonic('E');
jmb.add(exitMenu);
// Add menu items with mnemonics to menu "Operation"
operationMenu.add(jmiAdd= new JMenuItem("Add", 'A'));
operationMenu.add(jmiSub = new JMenuItem("Subtract", 'S'));
operationMenu.add(jmiMul = new JMenuItem("Multiply", 'M'));
operationMenu.add(jmiDiv = new JMenuItem("Divide", 'D'));
exitMenu.add(jmiClose = new JMenuItem("Close", 'C'));
// Set keyboard accelerators
jmiAdd.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
jmiSub.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
jmiMul.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK));
jmiDiv.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK));
// Panel p1 to hold text fields and labels
JPanel p1 = new JPanel();
p1.setLayout(new FlowLayout());
p1.add(new JLabel("Number 1"));
p1.add(jtfNum1 = new JTextField(3));
p1.add(new JLabel("Number 2"));
p1.add(jtfNum2 = new JTextField(3));
p1.add(new JLabel("Result"));
p1.add(jtfResult = new JTextField(4));
jtfResult.setEditable(false);
// Panel p2 to hold buttons
JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout());
p2.add(jbtAdd = new JButton("Add"));
p2.add(jbtSub = new JButton("Subtract"));
p2.add(jbtMul = new JButton("Multiply"));
p2.add(jbtDiv = new JButton("Divide"));
// Add panels to the frame
getContentPane().setLayout(new BorderLayout());
getContentPane().add(p1, BorderLayout.CENTER);
getContentPane().add(p2, BorderLayout.SOUTH);
// Register listeners
jbtAdd.addActionListener(this);
jbtSub.addActionListener(this);
jbtMul.addActionListener(this);
jbtDiv.addActionListener(this);
jmiAdd.addActionListener(this);
jmiSub.addActionListener(this);
jmiMul.addActionListener(this);
jmiDiv.addActionListener(this);
jmiClose.addActionListener(this);
/** Handle ActionEvent from buttons and menu items */
public void actionPerformed(ActionEvent e) {
String actionCommand = e.getActionCommand();
// Handle button events
if (e.getSource() instanceof JButton) {
if ("Add".equals(actionCommand))
calculate('+');
else if ("Subtract".equals(actionCommand))
calculate('-');
else if ("Multiply".equals(actionCommand))
calculate('*');
else if ("Divide".equals(actionCommand))
calculate('/');
else if (e.getSource() instanceof JMenuItem) {
// Handle menu item events
if ("Add".equals(actionCommand))
calculate('+');
else if ("Subtract".equals(actionCommand))
calculate('-');
else if ("Multiply".equals(actionCommand))
calculate('*');
else if ("Divide".equals(actionCommand))
calculate('/');
else if ("Close".equals(actionCommand))
System.exit(0);
/** Calculate and show the result in jtfResult */
private void calculate(char operator) {
// Obtain Number 1 and Number 2
int num1 = (Integer.parseInt(jtfNum1.getText().trim()));
int num2 = (Integer.parseInt(jtfNum2.getText().trim()));
int result = 0;
// Perform selected operation
switch (operator) {
case '+': result = num1 + num2;
break;
case '-': result = num1 - num2;
break;
case '*': result = num1 * num2;
break;
case '/': result = num1 / num2;
// Set result in jtfResult
jtfResult.setText(String.valueOf(result));
Original 2 button menu example....
// Exercise11_8.java: Create multiple windows
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Exercise11_8 extends JFrame implements ActionListener {
// Declare and create a frame: an instance of MenuDemo
MenuDemo calcFrame = new MenuDemo();
// Declare and create a frame: an instance of RadioButtonDemo
RadioButtonDemo lightsFrame = new RadioButtonDemo();
// Declare two buttons for displaying frames
private JButton jbtCalc;
private JButton jbtLights;
public static void main(String[] args) {
Exercise11_8 frame = new Exercise11_8();
frame.setSize( 400, 70 );
frame.setTitle("Exercise 11.8: Multiple Windows Demo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
public Exercise11_8() {
// Add buttons to the main frame
getContentPane().setLayout(new FlowLayout());
getContentPane().add(jbtCalc = new JButton("Simple Calculator"));
getContentPane().add(jbtLights = new JButton("Traffic Lights"));
// Register the main frame as listener for the buttons
jbtCalc.addActionListener(this);
jbtLights.addActionListener(this);
public void actionPerformed(ActionEvent e) {
String arg = e.getActionCommand();
if (e.getSource() instanceof JButton)
if ("Simple Calculator".equals(arg)) {
//show the MenuDemo frame
jbtCalc.setText("Hide Simple Calculator");
calcFrame.pack();
calcFrame.setVisible(true);
else if ("Hide Simple Calculator".equals(arg)) {
calcFrame.setVisible(false);
jbtCalc.setText("Simple Calculator");
else if ("Traffic Lights".equals(arg)) {
//show the CheckboxGroup frame
lightsFrame.pack();
jbtLights.setText("Hide Traffic Lights");
lightsFrame.setVisible(true);
else if ("Hide Traffic Lights".equals(arg)) {
lightsFrame.setVisible(false);
jbtLights.setText("Traffic Lights");
class RadioButtonDemo extends JFrame
implements ItemListener {
// Declare radio buttons
private JRadioButton jrbRed, jrbYellow, jrbGreen;
// Declare a radio button group
private ButtonGroup btg = new ButtonGroup();
// Declare a traffic light display panel
private Light light;
/** Main method */
public static void main(String[] args) {
RadioButtonDemo frame = new RadioButtonDemo();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(250, 170);
frame.setVisible(true);
/** Default constructor */
public RadioButtonDemo() {
setTitle("RadioButton Demo");
// Add traffic light panel to panel p1
JPanel p1 = new JPanel();
p1.setSize(200, 200);
p1.setLayout(new FlowLayout(FlowLayout.CENTER));
light = new Light();
light.setSize(40, 90);
p1.add(light);
// Put the radio button in Panel p2
JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout());
p2.add(jrbRed = new JRadioButton("Red", true));
p2.add(jrbYellow = new JRadioButton("Yellow", false));
p2.add(jrbGreen = new JRadioButton("Green", false));
// Set keyboard mnemonics
jrbRed.setMnemonic('R');
jrbYellow.setMnemonic('Y');
jrbGreen.setMnemonic('G');
// Group radio buttons
btg.add(jrbRed);
btg.add(jrbYellow);
btg.add(jrbGreen);
// Place p1 and p2 in the frame
getContentPane().setLayout(new BorderLayout());
getContentPane().add(p1, BorderLayout.CENTER);
getContentPane().add(p2, BorderLayout.SOUTH);
// Register listeners for check boxes
jrbRed.addItemListener(this);
jrbYellow.addItemListener(this);
jrbGreen.addItemListener(this);
/** Handle checkbox events */
public void itemStateChanged(ItemEvent e) {
if (jrbRed.isSelected())
light.turnOnRed(); // Set red light
if (jrbYellow.isSelected())
light.turnOnYellow(); // Set yellow light
if (jrbGreen.isSelected())
light.turnOnGreen(); // Set green light
// Three traffic lights shown in a panel
class Light extends JPanel {
private boolean red;
private boolean yellow;
private boolean green;
/** Default constructor */
public Light() {
turnOnGreen();
/** Set red light on */
public void turnOnRed() {
red = true;
yellow = false;
green = false;
repaint();
/** Set yellow light on */
public void turnOnYellow() {
red = false;
yellow = true;
green = false;
repaint();
/** Set green light on */
public void turnOnGreen() {
red = false;
yellow = false;
green = true;
repaint();
/** Display lights */
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (red) {
g.setColor(Color.red);
g.fillOval(10, 10, 20, 20);
g.setColor(Color.black);
g.drawOval(10, 35, 20, 20);
g.drawOval(10, 60, 20, 20);
g.drawRect(5, 5, 30, 80);
else if (yellow) {
g.setColor(Color.yellow);
g.fillOval(10, 35, 20, 20);
g.setColor(Color.black);
g.drawRect(5, 5, 30, 80);
g.drawOval(10, 10, 20, 20);
g.drawOval(10, 60, 20, 20);
else if (green) {
g.setColor(Color.green);
g.fillOval(10, 60, 20, 20);
g.setColor(Color.black);
g.drawRect(5, 5, 30, 80);
g.drawOval(10, 10, 20, 20);
g.drawOval(10, 35, 20, 20);
else {
g.setColor(Color.black);
g.drawRect(5, 5, 30, 80);
g.drawOval(10, 10, 20, 20);
g.drawOval(10, 35, 20, 20);
g.drawOval(10, 60, 20, 20);
/** Set preferred size */
public Dimension getPreferredSize() {
return new Dimension(40, 90);
class MenuDemo extends JFrame implements ActionListener {
// Text fields for Number 1, Number 2, and Result
private JTextField jtfNum1, jtfNum2, jtfResult;
// Buttons "Add", "Subtract", "Multiply" and "Divide"
private JButton jbtAdd, jbtSub, jbtMul, jbtDiv;
// Menu items "Add", "Subtract", "Multiply","Divide" and "Close"
private JMenuItem jmiAdd, jmiSub, jmiMul, jmiDiv, jmiClose;
/** Main method */
public static void main(String[] args) {
MenuDemo frame = new MenuDemo();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
/** Default constructor */
public MenuDemo() {
setTitle("Menu Demo");
// Create menu bar
JMenuBar jmb = new JMenuBar();
// Set menu bar to the frame
setJMenuBar(jmb);
// Add menu "Operation" to menu bar
JMenu operationMenu = new JMenu("Operation");
operationMenu.setMnemonic('O');
jmb.add(operationMenu);
// Add menu "Exit" in menu bar
JMenu exitMenu = new JMenu("Exit");
exitMenu.setMnemonic('E');
jmb.add(exitMenu);
// Add menu items with mnemonics to menu "Operation"
operationMenu.add(jmiAdd= new JMenuItem("Add", 'A'));
operationMenu.add(jmiSub = new JMenuItem("Subtract", 'S'));
operationMenu.add(jmiMul = new JMenuItem("Multiply", 'M'));
operationMenu.add(jmiDiv = new JMenuItem("Divide", 'D'));
exitMenu.add(jmiClose = new JMenuItem("Close", 'C'));
// Set keyboard accelerators
jmiAdd.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
jmiSub.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
jmiMul.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK));
jmiDiv.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK));
// Panel p1 to hold text fields and labels
JPanel p1 = new JPanel();
p1.setLayout(new FlowLayout());
p1.add(new JLabel("Number 1"));
p1.add(jtfNum1 = new JTextField(3));
p1.add(new JLabel("Number 2"));
p1.add(jtfNum2 = new JTextField(3));
p1.add(new JLabel("Result"));
p1.add(jtfResult = new JTextField(4));
jtfResult.setEditable(false);
// Panel p2 to hold buttons
JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout());
p2.add(jbtAdd = new JButton("Add"));
p2.add(jbtSub = new JButton("Subtract"));
p2.add(jbtMul = new JButton("Multiply"));
p2.add(jbtDiv = new JButton("Divide"));
// Add panels to the frame
getContentPane().setLayout(new BorderLayout());
getContentPane().add(p1, BorderLayout.CENTER);
getContentPane().add(p2, BorderLayout.SOUTH);
// Register listeners
jbtAdd.addActionListener(this);
jbtSub.addActionListener(this);
jbtMul.addActionListener(this);
jbtDiv.addActionListener(this);
jmiAdd.addActionListener(this);
jmiSub.addActionListener(this);
jmiMul.addActionListener(this);
jmiDiv.addActionListener(this);
jmiClose.addActionListener(this);
/** Handle ActionEvent from buttons and menu items */
public void actionPerformed(ActionEvent e) {
String actionCommand = e.getActionCommand();
// Handle button events
if (e.getSource() instanceof JButton) {
if ("Add".equals(actionCommand))
calculate('+');
else if ("Subtract".equals(actionCommand))
calculate('-');
else if ("Multiply".equals(actionCommand))
calculate('*');
else if ("Divide".equals(actionCommand))
calculate('/');
else if (e.getSource() instanceof JMenuItem) {
// Handle menu item events
if ("Add".equals(actionCommand))
calculate('+');
else if ("Subtract".equals(actionCommand))
calculate('-');
else if ("Multiply".equals(actionCommand))
calculate('*');
else if ("Divide".equals(actionCommand))
calculate('/');
else if ("Close".equals(actionCommand))
System.exit(0);
/** Calculate and show the result in jtfResult */
private void calculate(char operator) {
// Obtain Number 1 and Number 2
int num1 = (Integer.parseInt(jtfNum1.getText().trim()));
int num2 = (Integer.parseInt(jtfNum2.getText().trim()));
int result = 0;
// Perform selected operation
switch (operator) {
case '+': result = num1 + num2;
break;
case '-': result = num1 - num2;
break;
case '*': result = num1 * num2;
break;
case '/': result = num1 / num2;
// Set result in jtfResult
jtfResult.setText(String.valueOf(result));
Mortgage applet code....
// MortgageApplet.java: Applet for computing mortgage payments
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.TitledBorder;
public class MortgageApplet extends JApplet
implements ActionListener {
// Declare and create text fields for interest rate
// year, loan amount, monthly payment, and total payment
private JTextField jtfAnnualInterestRate = new JTextField();
private JTextField jtfNumOfYears = new JTextField();
private JTextField jtfLoanAmount = new JTextField();
private JTextField jtfMonthlyPayment = new JTextField();
private JTextField jtfTotalPayment = new JTextField();
// Declare and create a Compute Mortgage button
private JButton jbtComputeMortgage = new JButton("Compute Mortgage");
/** Initialize user interface */
public void init() {
// Set properties on the text fields
jtfMonthlyPayment.setEditable(false);
jtfTotalPayment.setEditable(false);
// Right align text fields
jtfAnnualInterestRate.setHorizontalAlignment(JTextField.RIGHT);
jtfNumOfYears.setHorizontalAlignment(JTextField.RIGHT);
jtfLoanAmount.setHorizontalAlignment(JTextField.RIGHT);
jtfMonthlyPayment.setHorizontalAlignment(JTextField.RIGHT);
jtfTotalPayment.setHorizontalAlignment(JTextField.RIGHT);
// Panel p1 to hold labels and text fields
JPanel p1 = new JPanel();
p1.setLayout(new GridLayout(5, 2));
p1.add(new Label("Annual Interest Rate"));
p1.add(jtfAnnualInterestRate);
p1.add(new Label("Number of Years"));
p1.add(jtfNumOfYears);
p1.add(new Label("Loan Amount"));
p1.add(jtfLoanAmount);
p1.add(new Label("Monthly Payment"));
p1.add(jtfMonthlyPayment);
p1.add(new Label("Total Payment"));
p1.add(jtfTotalPayment);
p1.setBorder(new
TitledBorder("Enter interest rate, year and loan amount"));
// Panel p2 to hold the button
JPanel p2 = new JPanel();
p2.setLayout(new FlowLayout(FlowLayout.RIGHT));
p2.add(jbtComputeMortgage);
// Add the components to the applet
getContentPane().add(p1, BorderLayout.CENTER);
getContentPane().add(p2, BorderLayout.SOUTH);
// Register listener
jbtComputeMortgage.addActionListener(this);
/** Handle the "Compute Mortgage" button */
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jbtComputeMortgage) {
// Get values from text fields
double interest = (Double.valueOf(
jtfAnnualInterestRate.getText())).doubleValue();
int year =
(Integer.valueOf(jtfNumOfYears.getText())).intValue();
double loan =
(Double.valueOf(jtfLoanAmount.getText())).doubleValue();
// Create a mortgage object
Mortgage m = new Mortgage(interest, year, loan);
// Display monthly payment and total payment
jtfMonthlyPayment.setText(String.valueOf(m.monthlyPayment()));
jtfTotalPayment.setText(String.valueOf(m.totalPayment()));
}Does it have to be an applet?
If you want the same behaviour as in the code with traffic lights, change
class MortgageApplet extends JApplet implements ActionListener {
to
class MortgageApplet extends JFrame implements ActionListener {
and change
public void init() {
to
public MortgageApplet() { -
What is it with yield() that I don't understand?
The following code starts a thread that awaits a notification that never comes. However, I was expecting the Foo main thread to enter the running state again sometime after it yields and print the last line "main running again", but not so. The program hangs and never execute main's last print statement.
class Task extends Thread {
Foo foo;
Task (Foo syncOnThis) {
foo = syncOnThis;
@Override
public void run () {
synchronized (foo) {
System.out.println("task has the foo lock.");
try {
System.out.println("task about to release lock.");
foo.wait();
} catch (InterruptedException ie) {
System.err.println("task was interrupted.");
System.out.println("task was notified!");
public class Foo {
private synchronized void notifier() {
notifyAll();
System.out.println("foo notified all");
public static void main(String[] args) {
Foo foo = new Foo();
Task alpha = new Task(foo);
alpha.start();
Thread.yield();
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
System.out.println("Foo's sleep interrupted");
System.out.println("main thread running again");
}My understanding of yield() is that it offers to demote the current thread to the runnable state in order to allow other threads - in this case Task - to enter the running state. But once Task calls wait(), it also retreats from the running state and this is where I expect the main thread to become running again.
If I swap yield() with something like
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
System.out.println("Foo's sleep interrupted");
}then it main does actually return to a running state and executes the last statement.
what is it with yield() that I don't understand?krzn wrote:
I see.Do also note that yield seldom is used these days. You most likely have a bug in your implementation or design if you think you need to call yield, or you are executing on a really old VM or on an odd system.
(The first versions of the Solaris VM didn't use round robin so you had to release the execution to avoid starvation.)
Kaj -
I don't understand Calendar in Leapard
I just upgraded to Leapard and I don't understand a few things about iCal.
1. All of my calendars - home, work, etc. - are listed under "calendars" at the upper left corner of the calendar. Then it shows my email address which is a dot mac email with my home calendar under the address and it is a different color square than my home calendar that is listed under calendars. When I try to delete the home calendar under my email address, I get a message that says it is being used to keep my to do's in mail and if I delete it, all of my to do's will be deleted. Why is this? And why is it a different color?
2. Why is my birthdays calendar now listed in subscriptions? What are subscriptions?
3. My calendars are published, do they have to be published if I use dot mac to sync with more than one computer?
4. Since I upgraded to Leapard, when I sync with my iPhone, all of the birthdays in my calendar appear twice in my iPhone. How do I fix this?
If anyone can answer these questions, I would greatly appreciate it.
Thanks.The following code is exactly the same (I removed the extraneous bit with "o"), but does not use the type parameter when creating the array, so it is allowed. (But type parameters are erased anyway, so effectively it is the same code.) It produces an unchecked warning, and fails at runtime. Can you see why it fails?
List<String>[] lsa = new List[10];
Object[] oa = lsa;
List<Integer> li = new ArrayList<Integer>();
li.add(new Integer(3));
oa[1] = li;
String s = lsa[1].get(0); // run-time error - ClassCastException -
CS5.5 INSTALL FAILS. 'payload' errors? i don't understand
don't understand what ANY of this means! CS5.5 INSTALL FAILS have retarted and tried multiple times . HELP please!
Exit Code: 6
Please see specific errors and warnings below for troubleshooting. For example, ERROR: DF006, DS013 ... WARNING: DS013, DW022 ...
-------------------------------------- Summary --------------------------------------
- 0 fatal error(s), 7 error(s), 47 warning(s)
WARNING: DW022: AdobeCode {AC76BA86-1033-F400-7760-000000000005} with version (2011-03-17 01:56:17.451315) already installed with incompatible version (2012-03-05 05:30:16.288604)
WARNING: DS013: Payload {AA0D312F-1570-4E7E-9A7D-E191E0090FEC} AdobeHelp 4.0.0.0 is already installed and the session payload {0175676F-8C92-49F2-9131-D0D6AD654B41} AdobeHelp 3.4.0.0 has no upgrade/conflict relationship with it.
WARNING: DS013: Payload {DE88AA40-6766-43D3-A755-8FC374B3D2C3} DynamiclinkSupport 6.0.0.0 is already installed and the session payload {1A1E5FF9-D0FD-42A3-8E18-E5E7E95E1AB4} DynamiclinkSupport 5.5.0.0 has no upgrade/conflict relationship with it.
WARNING: DS013: Payload {84901376-1C55-4BD3-AD2C-F9BDB4449DAC} PDF Settings CS5 10.0.0.0 is already installed and the session payload {8B4C951B-F853-4B05-B892-9D5B3CD8AC98} PDF Settings CS5 10.0.0.0 has no upgrade/conflict relationship with it.
ERROR: DS013: Verifying payload integrity : Failed with code 1
WARNING: DW016: NOTE: Cannot set action to the payload {9FE2BFB0-1DBE-4269-AEBA-A870C5990BEA} Adobe Dreamweaver Widget Browser 1.0.0.0 as it is already upgraded by the payload {85BD3EEB-DBBE-430A-A8F4-FE5D1E5AD606} Adobe Dreamweaver Widget Browser 1.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {E39A5ABD-516B-46F9-A042-694BBA6A4E08} Recommended Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {DE7C6FA1-AF75-48A8-B495-CFAD529BCC3D} Recommended Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {CBDD7465-CE11-4A58-9497-C370B65923F1} Required Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {311CDC89-AC18-4344-9EC9-0225328C73D3} Required Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {A2502D10-2D75-4620-8A8B-73F39D5C1243} PDF Settings CS5 10.0.0.0 as it is already upgraded by the payload {84901376-1C55-4BD3-AD2C-F9BDB4449DAC} PDF Settings CS5 10.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {E39A5ABD-516B-46F9-A042-694BBA6A4E08} Recommended Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {DE7C6FA1-AF75-48A8-B495-CFAD529BCC3D} Recommended Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {CBDD7465-CE11-4A58-9497-C370B65923F1} Required Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {311CDC89-AC18-4344-9EC9-0225328C73D3} Required Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {A2502D10-2D75-4620-8A8B-73F39D5C1243} PDF Settings CS5 10.0.0.0 as it is already upgraded by the payload {84901376-1C55-4BD3-AD2C-F9BDB4449DAC} PDF Settings CS5 10.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {A2502D10-2D75-4620-8A8B-73F39D5C1243} PDF Settings CS5 10.0.0.0 as it is already upgraded by the payload {84901376-1C55-4BD3-AD2C-F9BDB4449DAC} PDF Settings CS5 10.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {E39A5ABD-516B-46F9-A042-694BBA6A4E08} Recommended Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {DE7C6FA1-AF75-48A8-B495-CFAD529BCC3D} Recommended Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {CBDD7465-CE11-4A58-9497-C370B65923F1} Required Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {311CDC89-AC18-4344-9EC9-0225328C73D3} Required Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {9FE2BFB0-1DBE-4269-AEBA-A870C5990BEA} Adobe Dreamweaver Widget Browser 1.0.0.0 as it is already upgraded by the payload {85BD3EEB-DBBE-430A-A8F4-FE5D1E5AD606} Adobe Dreamweaver Widget Browser 1.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {E39A5ABD-516B-46F9-A042-694BBA6A4E08} Recommended Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {DE7C6FA1-AF75-48A8-B495-CFAD529BCC3D} Recommended Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {CBDD7465-CE11-4A58-9497-C370B65923F1} Required Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {311CDC89-AC18-4344-9EC9-0225328C73D3} Required Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {A2502D10-2D75-4620-8A8B-73F39D5C1243} PDF Settings CS5 10.0.0.0 as it is already upgraded by the payload {84901376-1C55-4BD3-AD2C-F9BDB4449DAC} PDF Settings CS5 10.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {E39A5ABD-516B-46F9-A042-694BBA6A4E08} Recommended Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {DE7C6FA1-AF75-48A8-B495-CFAD529BCC3D} Recommended Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {CBDD7465-CE11-4A58-9497-C370B65923F1} Required Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {311CDC89-AC18-4344-9EC9-0225328C73D3} Required Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {A2502D10-2D75-4620-8A8B-73F39D5C1243} PDF Settings CS5 10.0.0.0 as it is already upgraded by the payload {84901376-1C55-4BD3-AD2C-F9BDB4449DAC} PDF Settings CS5 10.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {A2502D10-2D75-4620-8A8B-73F39D5C1243} PDF Settings CS5 10.0.0.0 as it is already upgraded by the payload {84901376-1C55-4BD3-AD2C-F9BDB4449DAC} PDF Settings CS5 10.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {E39A5ABD-516B-46F9-A042-694BBA6A4E08} Recommended Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {DE7C6FA1-AF75-48A8-B495-CFAD529BCC3D} Recommended Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {CBDD7465-CE11-4A58-9497-C370B65923F1} Required Common Fonts Installation 1.0.0.0 as it is already upgraded by the payload {311CDC89-AC18-4344-9EC9-0225328C73D3} Required Common Fonts Installation 2.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW016: NOTE: Cannot set action to the payload {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 as it is already upgraded by the payload {539AEF15-3A2B-4A31-A587-7E90F7D9C700} Camera Profiles Installer 7.0.0.0
WARNING: DW031: Payload:{6A2E619B-E4AC-433B-A648-D458CE543A96} Adobe XMP Panels CS5 3.0.0.0 has been updated and has been selected for repair. The patch {5C0FEBDA-5A0E-4FC8-91CB-229A4C1561E9} Adobe XMP Panels CS5_3.1_AdobeXMPPanelsAll 3.1.0.0 will be uninstalled now.
WARNING: DW031: Payload:{37AB3C65-E02C-4DCF-B0E0-4C2E253D8FA3} Photoshop Camera Raw 6.0.0.0 has been updated and has been selected for repair. The patch {FD58D99B-9927-4226-8E00-959A4F76BD89} Photoshop Camera Raw_6.3_AdobeCameraRaw6.0All 6.3.0.0 will be uninstalled now.
WARNING: DW031: Payload:{6A2E619B-E4AC-433B-A648-D458CE543A96} Adobe XMP Panels CS5 3.0.0.0 has been updated and has been selected for repair. The patch {5C0FEBDA-5A0E-4FC8-91CB-229A4C1561E9} Adobe XMP Panels CS5_3.1_AdobeXMPPanelsAll 3.1.0.0 will be uninstalled now.
WARNING: DW031: Payload:{37AB3C65-E02C-4DCF-B0E0-4C2E253D8FA3} Photoshop Camera Raw 6.0.0.0 has been updated and has been selected for repair. The patch {FD58D99B-9927-4226-8E00-959A4F76BD89} Photoshop Camera Raw_6.3_AdobeCameraRaw6.0All 6.3.0.0 will be uninstalled now.
----------- Payload: {DEA79551-23E3-430A-9B15-B544479B7DB2} Flash Player 10.2.153.1 -----------
WARNING: DF009: Higher version plugin already exists at: /Library/Internet Plug-Ins/Flash Player.plugin(Seq 48)
WARNING: DF010: Not installing plugin to: /Library/Internet Plug-Ins/Flash Player.plugin(Seq 48)
----------- Payload: {4B4C871D-9C8A-4C8A-B92A-C37273D6CE7D} Adobe Fireworks CS5.1 11.1.0.0 -----------
WARNING: DF012: File/Folder does not exist at /Volumes/CS5_5 Design Prm 1/Adobe CS5_5 Design Premium/payloads/AdobeFireworks11.1.0All/OEM(Seq 3960)
----------- Payload: {8AB04F7C-8AEF-4023-9CDB-F761E4ECF9CC} Adobe Fireworks CS5.1_AdobeFireworks11.1.0en_USLanguagePack 11.1.0.0 -----------
WARNING: DF012: File/Folder does not exist at /Volumes/CS5_5 Design Prm 1/Adobe CS5_5 Design Premium/payloads/AdobeFireworks11.1.0en_USLanguagePack/OEM(Seq 86)
----------- Payload: {08EF22BC-43B2-4B4E-BA12-52B18F418F38} Adobe Photoshop CS5.1 Core 12.1.0.0 -----------
ERROR: DF006: The path "/Library/ScriptingAdditions/Adobe Unit Types.osax" already exists and is not a directory, Please rename or delete and retry(Seq 2751)
ERROR: DF016: Unable to create directory "/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents" with mode 775(Seq 2751)
ERROR: DF006: The path "/Library/ScriptingAdditions/Adobe Unit Types.osax" already exists and is not a directory, cannot create path "/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents",Please rename/delete "/Library/ScriptingAdditions/Adobe Unit Types.osax" and retry(Seq 2751)
ERROR: DW063: Command ARKCreateDirectoryCommand failed.(Seq 2751)
WARNING: DW036: Payload cannot be installed due to dependent operation failure
ERROR: DW050: The following payload errors were found during install:
ERROR: DW050: - Adobe Photoshop CS5.1 Core: Failed due to Language Pack installation failure
ERROR: DW050: - Adobe Photoshop CS5.1 English Language Pack_AdobePhotoshop12-en_US: Install failedLizhale the errors you have posted indicate that your file permissions have become compromised. In specific it would appear that your User account is failing to modify the /Library/ScriptingAdditions directory. Please see Error "Exit 6" or "Exit 7" | Install log | Read, write, system file errors | CS5, CS5.5 - http://helpx.adobe.com/creative-suite/kb/error-exit-6-exit-7.html for information on how to adjust your compromised file permissions.
-
Don't understand the java.lang.OutOfMemoryError
Hi there,
I try to create an 'About' frame for a small programm I created and I get an java.lang.OutOfMemoryError which I don't understand. Can somebody help?
Here is my code:
* TabbedPaneDemo.java is a 1.4 example that requires one additional file:
* images/middle.gif.
import javax.swing.JTabbedPane;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JComponent;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.KeyEvent;
import java.awt.Dimension;
import java.awt.Rectangle;
public class TabbedAbout extends JPanel {
JLabel label=new JLabel("PRODUCT INFORMATION ");
JLabel pv=new JLabel("Product version:");
JLabel pvR=new JLabel("1.0");
JLabel javav=new JLabel("Java Version:");
JLabel javavR=new JLabel("1.4.2");
JLabel sqlv=new JLabel("PostgreSQL Version:");
JLabel sqlvR=new JLabel("8.1");
JLabel pt=new JLabel("Programming Team:");
JLabel onoma1=new JLabel("Gkisis Traianos");
JLabel onoma2=new JLabel("Zafeiropoulos Ioannis");
JLabel onoma3=new JLabel("Supervisor Teacher:");
JLabel onoma3R=new JLabel("Stamatis Dimosthenis");
JLabel alr=new JLabel("Product developed as dissertation for the ATEI");
JLabel alr2=new JLabel("Thessaloniki on autumn 2006.");
JLabel alr1=new JLabel("All rights reserved");
ImageIcon icon = createImageIcon("images/folder_sticky.gif");
ImageIcon icon2 = createImageIcon("images/tick.gif");
public TabbedAbout() {
JLabel panel1 = new JLabel();
JFrame frame = new JFrame("About");
JFrame.setDefaultLookAndFeelDecorated(true);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
//super(new GridLayout(1, 1));
JTabbedPane tabbedPane = new JTabbedPane();
panel1.setIcon(new ImageIcon("images/TakeANoteProgress.jpg"));
tabbedPane.addTab("About", icon, panel1);
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
JPanel panel2 = new JPanel();
//JFrame frame2 = new JFrame();
panel2.setLayout(null);
label.setIcon(icon2);
label.setBounds(new Rectangle(20, 20, 200, 25));
pv.setBounds(new Rectangle(20, 40, 175, 45));
pvR.setBounds(new Rectangle(180, 40, 175, 45));
javav.setBounds(new Rectangle(20, 60, 175, 45));
javavR.setBounds(new Rectangle(180, 60, 175, 45));
sqlv.setBounds(new Rectangle(20, 80, 175, 45));
sqlvR.setBounds(new Rectangle(180, 80, 175, 45));
pt.setBounds(new Rectangle(20, 100, 175, 45));
onoma1.setBounds(new Rectangle(180, 100, 175, 45));
onoma2.setBounds(new Rectangle(180, 120, 175, 45));
onoma3.setBounds(new Rectangle(20, 140, 175, 45));
onoma3R.setBounds(new Rectangle(180, 140, 175, 45));
alr.setBounds(new Rectangle(20, 190, 500, 45));
alr2.setBounds(new Rectangle(20, 210, 500, 45));
alr1.setBounds(new Rectangle(20, 250, 500, 45));
panel2.add(label);
panel2.add(pv);
panel2.add(pvR);
panel2.add(javav);
panel2.add(javavR);
panel2.add(sqlv);
panel2.add(sqlvR);
panel2.add(pt);
panel2.add(onoma1);
panel2.add(onoma2);
panel2.add(onoma3);
panel2.add(onoma3R);
panel2.add(alr);
panel2.add(alr2);
panel2.add(alr1);
tabbedPane.addTab("Detail", icon, panel2);
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
tabbedPane.setSize(new Dimension(400, 300));
//Add the tabbed pane to this panel.
add(tabbedPane);
//Uncomment the following line to use scrolling tabs.
//tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
//Create and set up the content pane.
JComponent newContentPane = new TabbedAbout();
newContentPane.setOpaque(true); //content panes must be opaque
frame.getContentPane().add(new TabbedAbout(),
BorderLayout.CENTER);
//Display the window.
frame.setLocationRelativeTo(super.getComponent(0));
frame.pack();
frame.setResizable(false);
frame.setVisible(true);
protected JComponent makeTextPanel(String text) {
JPanel panel = new JPanel(false);
JLabel filler = new JLabel(text);
filler.setHorizontalAlignment(JLabel.CENTER);
//panel.setLayout(new GridLayout(1, 1));
panel.add(filler);
return panel;
/** Returns an ImageIcon, or null if the path was invalid. */
protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = TabbedAbout.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file: " + path);
return null;
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
// private static void createAndShowGUI() {
//Make sure we have nice window decorations.
//Create and set up the window.
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() {
TabbedAbout a=new TabbedAbout();
}Thanks in advanceI will try your suggestions. But still I don't understand. It was running independently very ok and it was what I wanted. It was built excatly as the example in
With run and main etc etc. But when I put it in my rest program it started and stack overflow error. Then I tried to change, change, change and got this last form.
This is what I had before but didn't work with my rest program.
* TabbedPaneDemo.java is a 1.4 example that requires one additional file:
* images/middle.gif.
import javax.swing.JTabbedPane;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JComponent;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.KeyEvent;
import java.awt.Dimension;
import java.awt.Rectangle;
public class TabbedAbout extends JPanel {
JLabel label=new JLabel("PRODUCT INFORMATION ");
JLabel pv=new JLabel("Product version:");
JLabel pvR=new JLabel("1.0");
JLabel javav=new JLabel("Java Version:");
JLabel javavR=new JLabel("1.4.2");
JLabel sqlv=new JLabel("PostgreSQL Version:");
JLabel sqlvR=new JLabel("8.1");
JLabel pt=new JLabel("Programming Team:");
JLabel onoma1=new JLabel("Gkisis Traianos");
JLabel onoma2=new JLabel("Zafeiropoulos Ioannis");
JLabel onoma3=new JLabel("Supervisor Teacher:");
JLabel onoma3R=new JLabel("Dimosthenis Stamatis");
JLabel alr=new JLabel("Product developed as dissertation for the ATEI Thessaloniki on autumn 2006.");
JLabel alr1=new JLabel("All rights reserved");
public TabbedAbout() {
//super(new GridLayout(1, 1));
JTabbedPane tabbedPane = new JTabbedPane();
ImageIcon icon = createImageIcon("images/folder_sticky.gif");
JLabel panel1 = new JLabel();
panel1.setIcon(new ImageIcon("images/TakeANote.jpg"));
tabbedPane.addTab("About", icon, panel1);
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
JPanel panel2 = new JPanel();
JFrame frame = new JFrame();
panel2.setLayout(null);
label.setBounds(new Rectangle(170, 20, 150, 25));
pv.setBounds(new Rectangle(90, 40, 175, 45));
pvR.setBounds(new Rectangle(220, 40, 175, 45));
javav.setBounds(new Rectangle(90, 60, 175, 45));
javavR.setBounds(new Rectangle(220, 60, 175, 45));
sqlv.setBounds(new Rectangle(90, 80, 175, 45));
sqlvR.setBounds(new Rectangle(220, 80, 175, 45));
pt.setBounds(new Rectangle(90, 100, 175, 45));
onoma1.setBounds(new Rectangle(220, 100, 175, 45));
onoma2.setBounds(new Rectangle(220, 120, 175, 45));
onoma3.setBounds(new Rectangle(90, 140, 175, 45));
onoma3R.setBounds(new Rectangle(220, 140, 175, 45));
alr.setBounds(new Rectangle(30, 170, 500, 45));
alr1.setBounds(new Rectangle(170, 190, 500, 45));
panel2.add(label);
panel2.add(pv);
panel2.add(pvR);
panel2.add(javav);
panel2.add(javavR);
panel2.add(sqlv);
panel2.add(sqlvR);
panel2.add(pt);
panel2.add(onoma1);
panel2.add(onoma2);
panel2.add(onoma3);
panel2.add(onoma3R);
panel2.add(alr);
panel2.add(alr1);
tabbedPane.addTab("Detail", icon, panel2);
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
tabbedPane.setSize(new Dimension(400, 300));
//Add the tabbed pane to this panel.
add(tabbedPane);
//Uncomment the following line to use scrolling tabs.
//tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
protected JComponent makeTextPanel(String text) {
JPanel panel = new JPanel(false);
JLabel filler = new JLabel(text);
filler.setHorizontalAlignment(JLabel.CENTER);
//panel.setLayout(new GridLayout(1, 1));
panel.add(filler);
return panel;
/** Returns an ImageIcon, or null if the path was invalid. */
protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = TabbedAbout.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file: " + path);
return null;
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
JFrame frame = new JFrame("About");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent newContentPane = new TabbedAbout();
newContentPane.setOpaque(true); //content panes must be opaque
frame.getContentPane().add(new TabbedAbout(),
BorderLayout.CENTER);
//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();
}But independetly was working just fine. Excatly as I wanted
Message was edited by:
sickboy -
Don't understand the workflow in e-commerce
Is there a place to see the backend of an online store working, or to see how it's supposed to be set up? My previous experience with shipping cart systems is that once the order is placed, it gives you the ability to change the status of the order, from something like "processing" to "shipped" or maybe "In Progress". Once you change it to "Shipped", it updates the customer via email and it takes the order off any WIP reports.
I setup the online store in a dummy company, and ordered something from it, using "COD" for payment, then I went to see how all that worked. I can't see anything that moves the order through the process to the end. It looks like that might be something I have to setup with workflows. Is that correct? If not, how does the order go from a new order to a shipped order?
I'm sure it does it or can do it, I just don't understand the way it all works. A tutorial or demo would be great, but I haven't been able to locate one.
Thanks in advance for any help!Hi,
The order status is changed as explained here -> http://kb.worldsecuresystems.com/kb/order-status.html
and payment is applied to the cash order as explained here -> http://kb.worldsecuresystems.com/kb/order-payments.html
Hope that helps!
Please let us know for any further assistance.
Kind Regards, -
Don't understand what this means I/O Error: import file
I'm building a website in dreamweaver cs5 with a XML doctype. When I tried to validate my css I got an error code I don't understand. This is the error: I/O Error: import file:/Volumes/Macintosh%20HD/Users/schweideltyson/Desktop/CS%2080_final%20project/gallery .html: Operation not permitted. Any suggestions? The only thing I can think of is that I imported some text for my index page from another website.
XML is used for data. This is an example of a media playlist in XML.
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track><location>file:///mp3s/song_1.mp3</location></track>
<track><location>file:///mp3s/song_2.mp3</location></track>
<track><location>file:///mp3s/song_3.mp3</location></track>
</trackList>
</playlist>
XHTML is for web pages.
http://www.w3schools.com/html/html_doctype.asp
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb -
Last time i usually pay the purchasing item using my debit visa card.
after that i no more use the debit visa card.
i'm using mastercard.
now each time i want to purchase anything, i cannot pay using the mastercard.
when i insert all the details including the expiry date, apple will show an error. only the expiry date.
i don't understand why.Does it have to be an applet?
If you want the same behaviour as in the code with traffic lights, change
class MortgageApplet extends JApplet implements ActionListener {
to
class MortgageApplet extends JFrame implements ActionListener {
and change
public void init() {
to
public MortgageApplet() { -
[SOLVED] Apparently, I don't understand mount
Hey there!
I'm having some problems with automounting and other things, so I started working on fixing that, but first I at least want to get a few things sorted out.
For example, when I want to mount a CD-ROM, what I currently do is this:
1) start thunar in _root_ mode, if I don't do it in root it complains with a HAL error that it can't do it
2) click the CD icon in left pane
3) do my stuff (usually start smplayer )
To unmount, I just type "sudo umount /media/dvd"
Now, I was going to check on this HAL issue, but then a friend of mine alerted me to the fact that I shouldn't even be using sudo to mount.
I was curious as to why, it seems logical to need root privileges for something like that.
But then he told me about executable permissions, my mount had "-rwxr-xr-x", his had "-rwsr-xr-x". He told me about the "s" flag and how it makes the system think that you're root
when you execute it without sudo, even if you're not. So I changed the permissions on my /bin/mount. It still wouldn't work, it told me I needed to be root to mount. Then I changed the group of the
executable to "storage" instead of "root". Still no dice (even though my user is a member of storage).
I'd like to get this minor niggle fixed first before I try to even contemplate tackling the horrible mess that is udev/hal (I don't understand anything about it).
Thanks in advance!
Last edited by Aktau (2009-05-25 16:03:49)Mr.Elendig wrote:
Aktau wrote:
Thanks for your replies!
Do you perhaps know why my mount just will not work without sudo? even though I have the "s" flag in user en the "x" flag in group and user? I'd really like to understand the fundamental issue here.
Once again, thanks for your swift and helpful replies, it's much appreciated.
You can only use mount and umount on a mount point, as a user, if it's in fstab with the 'user' or 'users' option. This is a security feature to prevent users from doing nasty things.
Hmmm, it makes sense from a security point of view.
I've also been digging around in the mount source code, some of the strange things I've encountered while using it that are in the source:
LINE: 918 in mount.c
switch (mnt_err) {
case EPERM:
if (geteuid() == 0) {
if (stat (node, &statbuf) || !S_ISDIR(statbuf.st_mode))
error (_("mount: mount point %s is not a directory"), node);
else
error (_("mount: permission denied"));
} else {
error (_("mount: must be superuser to use mount"));
break;
I've gotten the "mount: must be superuser to use mount" error at least once. This is really strange, as now it's checking on effective uid, which should be root for me
LINE: 1616 in mount.c
if (getuid () != geteuid ()) {
suid = 1;
if (types || options || readwrite || nomtab || mount_all ||
fake || mounttype || (argc + specseen) != 1)
die (EX_USAGE, _("mount: only root can do that"));
Look at those conditions, that's just damn weird. These are both single occurences btw, so I know I've made it that far in the code path
Last edited by Aktau (2009-05-25 15:22:31)
Maybe you are looking for
-
ITunes remote for iPad? Cropping the info bar request...
Sorry about the double idea here but remote for the iPad would be nice like as is on iPhone and also the ability to crop a screenshot without 3rd party apps would be nice too.
-
Hello I am using JSF 1.0 and I can not get a command_link to work the follwing code <h:command_link action="IncidentBeanUtil.reasonaction" value = "Next>>"/> generates the follwing error jasper.JasperException: /mainPage.jsp(179,3) No tag "command_li
-
Internal error occured...Reader XI
I've been getting the message "an internal error occurred" the last few times I've tried using Reader XI on my Windows 8.1 laptop. I've even gone as far as using Revo Uninstaller AND the tool at http://labs.adobe.com/downloads/acrobatcleaner.html w
-
Has anyone had trouble with word freezing after installation of adobe acrobat 9 professional?
Has anyone had troubel with Word fr eezign after instillation of adobe acrobat 9 professional and what did you do to res olve it?
-
Query regarding the fields details in particular form for all the users in
Dear All, I have one query regarding the fields details in particular form for all the users in company. Let take an exapmle if i had created Purchase Order having fields in content tab as 1.Item No. 2.Quantity 3.Unit Proce 4.Total