I can't make this coder in applescript work
I'm making a script that makes a text file, then replaces some letters with others. To make it unreadable. Im doing this because what i then could use another script in reverse to make it like the text i first submitted. The problem is: When i run the script it does give me the same text as i submit first back without coding it. Please help me
Here is my script.
set my_password to display dialog ¬
"Please enter your password:" with title ¬
"Password" with icon caution ¬
default answer ¬
"" buttons {"Cancel", "OK"} default button 2 ¬
giving up after 295 ¬
with hidden answer
if text returned of my_password is "mm" then
display dialog "Access Granted!" buttons ["OK"] default button 1
else
quit
end if
display dialog "MM C0ding prototype version 1.00" default answer "" buttons {"Code"} default button 1
set dialogText to {text returned of result}
do shell script "echo " & dialogText & " > ~/desktop/foo.txt"
set file_path to POSIX path of " ~/Desktop/foo.txt"
set search_string to "a"
set replacement_text to "f"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "b"
set replacement_text to "g"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "c"
set replacement_text to "h"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "d"
set replacement_text to "i"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "e"
set replacement_text to "j"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "f"
set replacement_text to "0"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "g"
set replacement_text to "1"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "h"
set replacement_text to "2"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "i"
set replacement_text to "3"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "j"
set replacement_text to "4"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "k"
set replacement_text to "p"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "l"
set replacement_text to "q"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "m"
set replacement_text to "r"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "n"
set replacement_text to "s"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "o"
set replacement_text to "t"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "p"
set replacement_text to "5"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "q"
set replacement_text to "6"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "r"
set replacement_text to "7"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "s"
set replacement_text to "8"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "t"
set replacement_text to "9"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "u"
set replacement_text to "x"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "v"
set replacement_text to "y"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "w"
set replacement_text to "z"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "x"
set replacement_text to "U"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "y"
set replacement_text to "V"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set search_string to "z"
set replacement_text to "W"
do shell script "perl -pi -e 's/" & search_string & "/" & replacement_text & "/g' " & quoted form of (POSIX path of file_path)
set milefile to ("Users:madsludvigtimmfagerlund:Desktop:foo.txt")
set finalcode to (read file milefile)
display dialog "Your code is:
" & finalcode buttons {"OK"}
Use code such as:
set answer to text returned of (display dialog " Which password do you need?" default answer "")
if answer contains "hotmail account" then set button_pressed to button returned of (display dialog " Password: 1234" buttons {"Ok", "Back"})
if button_pressed is "back" then
set answer to text returned of (display dialog " Which password do you need?" default answer "")
end if
or:
repeat
set answer to text returned of (display dialog " Which password do you need?" default answer "")
if answer contains "hotmail account" then display dialog " Password: 1234" buttons {"Run again", "Cancel"}
end repeat
(43497)
Similar Messages
-
How can I make this code faster? optimized.
Its part of two jsp pages that go back and forth. I feel I am creating new strings all of the time. I have 3 graphic representations of a radion button and a check box. its for a quiz program.
if the button is not checked, it uses rd0.gif.
if the button is checked, then its assigned rd1.gif.
However, if the button is the wrong answer, then its assigned rd2.gif.
the use of char arrays is neccasary, but not vital, I guess I could use indexof in the string. But I Dont know if its faster. I want to optimize the code, so it uses less resources.
heres the code
TrueFalse=entry[11].indexOf("TRUE");
myButton = Integer.parseInt((String)session.getAttribute("BUTTONNO"));
GivenAnswer =(String)session.getAttribute("GIVEN");
if(TrueFalse==-1) {
char[] questions = GivenAnswer.toCharArray();
for(x=1;x<5;x++) {
if(questions[x]=='1') { bp[x]="images/ck1.gif"; }else{ bp[x]="images/ck0.gif";}
}else{
if(myButton==1) {bp[1] = "images/rd1.gif";} else {bp[1] = "images/rd0.gif";}
if(myButton==2) {bp[2] = "images/rd1.gif";} else {bp[2] = "images/rd0.gif";}
questions is discarded.
the quiz is fast at the begining, but once you go deeper and deeper it slows down. This is the second page:
<%@ include file ="include4.jsp" %>
<%
session.setAttribute("BUTTONNO", "1");
GivenAnswer =(String)session.getAttribute("GIVEN");
char[] questions = GivenAnswer.toCharArray();
questions[1]='1';
tempString = new String (questions);
GivenAnswer = tempString;
session.setAttribute("GIVEN", GivenAnswer);
%>
<jsp:forward page="train2.jsp">
</jsp:forward>
I tried to keep all of the code on one page, but I am using images instead of real radio buttons, for several reasons. JSP doesnt seem to return a value for check/radio buttons in JSP, so clicking on an anchored image and going to a second JSP PAge seemed reasonable. I dont know how to force garbage collection. But the speed in which the pages and images appear, get slower and slower. so I Think im using up memory (Stings) at a greater rate than I should.
thanks
MIKe NIEMI
[email protected]I'm not sure that an "optimisation" is necessarily what you're after. I doubt it's the creation of Strings that's causing any performance issue - even if it is then it's probably the result of something more sinister.
Don't assume that your code is using a lot of resources.
For example it's tempting to change it to this:
if(myButton==1) {bp[1] = "images/rd1.gif";} else {bp[1] = "images/rd0.gif";}
if(myButton==2) {bp[2] = "images/rd1.gif";} else {bp[2] = "images/rd0.gif";}
// change to this?
bp[myButton] = "images/rd1.gif";
bp[3 - myButton] = "images/rd0.gif";I'd say that the original code was clearer and used just as many resources (once the Strings are interned).
The same goes for this:
if(questions[x]=='1') { bp[x]="images/ck1.gif"; }else{ bp[x]="images/ck0.gif";}
// change to this?
bp[x] = "images/ck" + questions[x] + ".gif";Again, the former is possibly clearer as it indicates that questions is really a boolean flag - it should also be easily optimised by the compiler.
You're right that you could replace "questions" by simply using GivenAnswer.charAt(x).
Enterprise Java applications can generate hundreds of thousands of Strings during their execution - your Servlet is unlikely to have a serious impact on that unless you've got an enormous loop in there or a very large user base.
A golden rule of optimisation is not to assume that you know where the performance/resource bottlenecks are. Measure the improvement you get from a change - does it warrant the resultant increase in the complexity of the code?
Put some profiling in your code - how long is it taking to run your Servlet? How many times is it being invoked? I can't imagine that the code you've provided will take more than a few milliseconds to run.
Also, you can't force garbage collection. You can suggest it to the Java runtime (it might not even have a garbage collector!). However, this generally indicates a flaw in the application and should be avoided unless absolutely necessary (and it's not in this case!).
If you really want to optimise then get hold of something like OptimizeIt - it will provide a great deal of information about what's being created and where.
Hope this helps. -
Can we make this query shorter....?
hi there
Can any body help me in reducing the number of lines in this query ! I am using union to concat 3 queries. Select fields in every query are same and in where condition also most of the joins are same in every query. but in where clause only two conditions are different. Can we make this 3 queries into one becoze entire select statement fields are same and most of the where conditions are same !
Below is the query:
SELECT
au1.bu_id,
au1.first_nam,
au1.last_nam,
c.id,
c.first_nam_d,
c.last_nam_d,
c.birth_dte_d,
c.ssn_num_d,
se.id schd_event_id,
seu.dsc,
ssc.dsc,
sea.access_typ,
sea.ATTENDEE_TYP
FROM
CLIENT c,
APP_USER au1,
SCHD_STAT_CD ssc,
schd_event_url seu,
schd_evnt se,
SCHD_evnt_stat ses,
SCHD_EVNT_ATTENDEE sea,
CLIENT_APPT ca
WHERE
c.id = ca.client_id_k AND
au1.bu_id = se.APP_USER_BU_ID_PRIME_K AND
ssc.code = ses.SCHD_STAT_CD_CODE_K AND
seu.code = se.SCHD_EVNT_URL_CODE_K AND
se.id = ses.SCHD_EVNT_ID_K AND
se.id = sea.SCHD_EVNT_ID_K(+) AND
se.id = ca.SCHD_EVNT_ID_K AND
sea.ATTENDEE_TYP(+) = 'WORKER' AND
ses.create_ts = (select max(create_ts) FROM SCHD_evnt_stat ses1 WHERE ses1.SCHD_EVNT_ID_K = ses.SCHD_EVNT_ID_K)
UNION
SELECT
au1.bu_id,
au1.first_nam,
au1.last_nam,
c.id,
c.first_nam_d,
c.last_nam_d,
c.birth_dte_d,
c.ssn_num_d,
se.id schd_event_id,
seu.dsc,
ssc.dsc,
FROM
CLIENT c,
APP_USER au1,
SCHD_STAT_CD ssc,
schd_event_url seu,
schd_evnt se,
SCHD_evnt_stat ses,
SCHD_EVNT_ATTENDEE sea,
CLIENT_APPT ca
WHERE
c.id = ca.client_id_k AND
au1.bu_id = se.APP_USER_BU_ID_PRIME_K AND
ssc.code = ses.SCHD_STAT_CD_CODE_K AND
seu.code = se.SCHD_EVNT_URL_CODE_K AND
se.id = ses.SCHD_EVNT_ID_K AND
se.id = sea.SCHD_EVNT_ID_K AND
se.id = ca.SCHD_EVNT_ID_K AND
sea.ATTENDEE_TYP = 'ROLE' AND
ses.create_ts = (select max(create_ts) FROM SCHD_evnt_stat ses1 WHERE ses1.SCHD_EVNT_ID_K = ses.SCHD_EVNT_ID_K)
UNION
SELECT
au1.bu_id,
au1.first_nam,
au1.last_nam,
c.id,
c.first_nam_d,
c.last_nam_d,
c.birth_dte_d,
c.ssn_num_d,
se.id schd_event_id,
seu.dsc,
ssc.dsc,
sea.access_typ,
sea.ATTENDEE_TYP
FROM
CLIENT c,
APP_USER au1,
SCHD_STAT_CD ssc,
schd_event_url seu,
schd_evnt se,
SCHD_evnt_stat ses,
SCHD_EVNT_ATTENDEE sea,
CLIENT_APPT ca
WHERE
c.id = ca.client_id_k AND
au1.APP_ROLE_NAM_DESKTOP_K = sea.ATTENDEE_ID_K AND
ssc.code = ses.SCHD_STAT_CD_CODE_K AND
seu.code = se.SCHD_EVNT_URL_CODE_K AND
se.id = ses.SCHD_EVNT_ID_K AND
se.id = sea.SCHD_EVNT_ID_K AND
se.id = ca.SCHD_EVNT_ID_K AND
sea.ATTENDEE_TYP = 'ROLE' AND
ses.create_ts = (select max(create_ts) FROM SCHD_evnt_stat ses1 WHERE ses1.SCHD_EVNT_ID_K = ses.SCHD_EVNT_ID_K)
Thanks in advance
prasanth a.s.Hi,
it is difficult to change this query without the possibility to test it in a worksheet. But try the following query.
I think it should be the same result as your 3 queries.
SELECT au1.bu_id,
au1.first_nam,
au1.last_nam,
c.id,
c.first_nam_d,
c.last_nam_d,
c.birth_dte_d,
c.ssn_num_d,
se.id schd_event_id,
seu.dsc,ssc.dsc,
decode(sea.access_typ,NULL,' ',sea.access_typ) AS sea.access_typ,
decode(sea.ATTENDEE_TYP,NULL,' ',sea.ATTENDEE_TYP) AS sea.ATTENDEE_TYP
FROM CLIENT c,
APP_USER au1,
SCHD_STAT_CD ssc,
schd_event_url seu,
schd_evnt se,
SCHD_evnt_stat ses,
SCHD_EVNT_ATTENDEE sea,
CLIENT_APPT ca
WHERE c.id = ca.client_id_k
AND au1.bu_id = se.APP_USER_BU_ID_PRIME_K
AND ssc.code = ses.SCHD_STAT_CD_CODE_K
AND seu.code = se.SCHD_EVNT_URL_CODE_K
AND se.id = ses.SCHD_EVNT_ID_K
AND se.id = ca.SCHD_EVNT_ID_K
AND ses.create_ts = (select max(create_ts)
FROM SCHD_evnt_stat ses1
WHERE ses1.SCHD_EVNT_ID_K = ses.SCHD_EVNT_ID_K)
AND
(sea.ATTENDEE_TYP(+) = 'WORKER' AND se.id = sea.SCHD_EVNT_ID_K(+)) --clause of the 1st query
OR
(sea.ATTENDEE_TYP = 'ROLE' AND se.id = sea.SCHD_EVNT_ID_K) --clause of the 2nd query
OR
(sea.ATTENDEE_TYP = 'ROLE' AND se.id = sea.SCHD_EVNT_ID_K AND au1.APP_ROLE_NAM_DESKTOP_K = sea.ATTENDEE_ID_K) --clause of the 3rd query
); -
Anyone knows how to make this code to netbeans??
anyone knows how to make this code to netbeans?? i just want to convert it into netbeans... im not really advance with this software... anyway..just reply if you have any idea...or steps how to build it... etc.... thanks guys...
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.regex.*;
public class FilterTable {
public static void main(String args[]) {
Runnable runner = new Runnable() {
public void run() {
JFrame frame = new JFrame("Sorting JTable");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object rows[][] = {
{"AMZN", "Amazon", 41.28},
{"EBAY", "eBay", 41.57},
{"GOOG", "Google", 388.33},
{"MSFT", "Microsoft", 26.56},
{"NOK", "Nokia Corp", 17.13},
{"ORCL", "Oracle Corp.", 12.52},
{"SUNW", "Sun Microsystems", 3.86},
{"TWX", "Time Warner", 17.66},
{"VOD", "Vodafone Group", 26.02},
{"YHOO", "Yahoo!", 37.69}
Object columns[] = {"Symbol", "Name", "Price"};
TableModel model =
new DefaultTableModel(rows, columns) {
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
returnValue = getValueAt(0, column).getClass();
} else {
returnValue = Object.class;
return returnValue;
JTable table = new JTable(model);
final TableRowSorter<TableModel> sorter =
new TableRowSorter<TableModel>(model);
table.setRowSorter(sorter);
JScrollPane pane = new JScrollPane(table);
frame.add(pane, BorderLayout.CENTER);
JPanel panel = new JPanel(new BorderLayout());
JLabel label = new JLabel("Filter");
panel.add(label, BorderLayout.WEST);
final JTextField filterText =
new JTextField("SUN");
panel.add(filterText, BorderLayout.CENTER);
frame.add(panel, BorderLayout.NORTH);
JButton button = new JButton("Filter");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String text = filterText.getText();
if (text.length() == 0) {
sorter.setRowFilter(null);
} else {
try {
sorter.setRowFilter(
RowFilter.regexFilter(text));
} catch (PatternSyntaxException pse) {
System.err.println("Bad regex pattern");
frame.add(button, BorderLayout.SOUTH);
frame.setSize(300, 250);
frame.setVisible(true);
EventQueue.invokeLater(runner);
}its okay onmosh.....what we need to
this...forum....is to have a good......relationship
of programmers......and to start with .....we need to
have a good attitude........right.....???.....no
matter how good you are in programming but if you did
not posses the right kind of attitude....everything
is useless.....in the first place....all we
want....is just to ask...some....help....but
conflicts......but unluckily......we did not expect
that there are members in here which......not
good...to follow.....just as suggestion for those
people not having the right kind of attidude...why
can't you do in a very nice message sharing in a very
nice....way....why we need to put some
stupid....stuff...words.....can't you live with out
******* ****....its not.....lastly especially you
have your children right now and people around...that
somehow......idiolize...you even me....is one of
them......but showing but attitude....is not
good......tnx....hope you'll take it this....in the
positive side.....be optimistic...guys....the
world..is not yours....all of us will just past
away....always..remember that one.....treasure..our
stay in this....temporary home.....which...is
world....Whoa. That post seems to be killing my brain.
URK
Join........us..........do not be..........afraid....... -
How can I make this join in ADF and make CRUD operation in this
How to make this relation in ADF
I have table employees and this is my master table
Table Name: Employees
Columns:
Employee_id(PK)
Employee_name
Employee_Salary
I have a child table that is called related employee that contains employees related to this employee
Table_name: Related_Employee
Columns:
Related_Employee_Table_Id(PK)
Employee_id(FK)
Related_Employee_Id
When I open employee id = 100 for example and add related employee id = 10
this is added with no problem but the requirement is that when I open employee 10 I find employee id 100 as related employee
How can I make this scenario.The best way to understand this is to look at an example. If you are using an oracle database such as XE for you have a schema called hr. This shema has a number of tables two of which are departments and employees. a department has multiple employees correct. So in your example a employee may be related to x # of other employees perhaps. A very similar scenario as that in the hr Schema. If you don't have an Oracle XE database, download one from here -> http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
Create Business Components off of the Departments and Employees schema and you'll see that due to the db design, you get what you're talking about for free (i.e. the join). Thus, you have the master-detail relationship you're looking for. For a quick tip, here is the relationship between departments and employees in the hr schema via a create script that you can exam with data inserts included:
SET SQLBLANKLINES ON
CREATE TABLE DEPARTMENTS
DEPARTMENT_ID NUMBER(4, 0) NOT NULL
, DEPARTMENT_NAME VARCHAR2(30 BYTE) NOT NULL
, MANAGER_ID NUMBER(6, 0)
, LOCATION_ID NUMBER(4, 0)
, CONSTRAINT DEPT_ID_PK PRIMARY KEY
DEPARTMENT_ID
USING INDEX
CREATE UNIQUE INDEX DEPT_ID_PK ON DEPARTMENTS (DEPARTMENT_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
ENABLE
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 1
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE TABLE EMPLOYEES
EMPLOYEE_ID NUMBER(6, 0) NOT NULL
, FIRST_NAME VARCHAR2(20 BYTE)
, LAST_NAME VARCHAR2(25 BYTE) NOT NULL
, EMAIL VARCHAR2(25 BYTE) NOT NULL
, PHONE_NUMBER VARCHAR2(20 BYTE)
, HIRE_DATE DATE NOT NULL
, JOB_ID VARCHAR2(10 BYTE) NOT NULL
, SALARY NUMBER(8, 2)
, COMMISSION_PCT NUMBER(2, 2)
, MANAGER_ID NUMBER(6, 0)
, DEPARTMENT_ID NUMBER(4, 0)
, CONSTRAINT EMP_EMP_ID_PK PRIMARY KEY
EMPLOYEE_ID
USING INDEX
CREATE UNIQUE INDEX EMP_EMP_ID_PK ON EMPLOYEES (EMPLOYEE_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
ENABLE
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 1
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX DEPT_LOCATION_IX ON DEPARTMENTS (LOCATION_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX EMP_DEPARTMENT_IX ON EMPLOYEES (DEPARTMENT_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX EMP_JOB_IX ON EMPLOYEES (JOB_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX EMP_MANAGER_IX ON EMPLOYEES (MANAGER_ID ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
CREATE INDEX EMP_NAME_IX ON EMPLOYEES (LAST_NAME ASC, FIRST_NAME ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_EMAIL_UK UNIQUE
EMAIL
USING INDEX
CREATE UNIQUE INDEX EMP_EMAIL_UK ON EMPLOYEES (EMAIL ASC)
LOGGING
TABLESPACE "USERS"
PCTFREE 10
INITRANS 2
STORAGE
INITIAL 65536
MINEXTENTS 1
MAXEXTENTS UNLIMITED
BUFFER_POOL DEFAULT
ENABLE;
ALTER TABLE DEPARTMENTS
ADD CONSTRAINT DEPT_LOC_FK FOREIGN KEY
LOCATION_ID
REFERENCES LOCATIONS
LOCATION_ID
ENABLE;
ALTER TABLE DEPARTMENTS
ADD CONSTRAINT DEPT_MGR_FK FOREIGN KEY
MANAGER_ID
REFERENCES EMPLOYEES
EMPLOYEE_ID
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_DEPT_FK FOREIGN KEY
DEPARTMENT_ID
REFERENCES DEPARTMENTS
DEPARTMENT_ID
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_JOB_FK FOREIGN KEY
JOB_ID
REFERENCES JOBS
JOB_ID
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_MANAGER_FK FOREIGN KEY
MANAGER_ID
REFERENCES EMPLOYEES
EMPLOYEE_ID
ENABLE;
ALTER TABLE DEPARTMENTS
ADD CONSTRAINT DEPT_NAME_NN CHECK
(DEPARTMENT_NAME IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_EMAIL_NN CHECK
(EMAIL IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_HIRE_DATE_NN CHECK
(HIRE_DATE IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_JOB_NN CHECK
(JOB_ID IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_LAST_NAME_NN CHECK
(LAST_NAME IS NOT NULL)
ENABLE;
ALTER TABLE EMPLOYEES
ADD CONSTRAINT EMP_SALARY_MIN CHECK
(SALARY > 0)
ENABLE;
COMMENT ON TABLE DEPARTMENTS IS 'Departments table that shows details of departments where employees
work. Contains 27 rows; references with locations, employees, and job_history tables.';
COMMENT ON TABLE EMPLOYEES IS 'employees table. Contains 107 rows. References with departments,
jobs, job_history tables. Contains a self reference.';
COMMENT ON COLUMN DEPARTMENTS.DEPARTMENT_ID IS 'Primary key column of departments table.';
COMMENT ON COLUMN DEPARTMENTS.DEPARTMENT_NAME IS 'A not null column that shows name of a department. Administration,
Marketing, Purchasing, Human Resources, Shipping, IT, Executive, Public
Relations, Sales, Finance, and Accounting. ';
COMMENT ON COLUMN DEPARTMENTS.MANAGER_ID IS 'Manager_id of a department. Foreign key to employee_id column of employees table. The manager_id column of the employee table references this column.';
COMMENT ON COLUMN DEPARTMENTS.LOCATION_ID IS 'Location id where a department is located. Foreign key to location_id column of locations table.';
COMMENT ON COLUMN EMPLOYEES.EMPLOYEE_ID IS 'Primary key of employees table.';
COMMENT ON COLUMN EMPLOYEES.FIRST_NAME IS 'First name of the employee. A not null column.';
COMMENT ON COLUMN EMPLOYEES.LAST_NAME IS 'Last name of the employee. A not null column.';
COMMENT ON COLUMN EMPLOYEES.EMAIL IS 'Email id of the employee';
COMMENT ON COLUMN EMPLOYEES.PHONE_NUMBER IS 'Phone number of the employee; includes country code and area code';
COMMENT ON COLUMN EMPLOYEES.HIRE_DATE IS 'Date when the employee started on this job. A not null column.';
COMMENT ON COLUMN EMPLOYEES.JOB_ID IS 'Current job of the employee; foreign key to job_id column of the
jobs table. A not null column.';
COMMENT ON COLUMN EMPLOYEES.SALARY IS 'Monthly salary of the employee. Must be greater
than zero (enforced by constraint emp_salary_min)';
COMMENT ON COLUMN EMPLOYEES.COMMISSION_PCT IS 'Commission percentage of the employee; Only employees in sales
department elgible for commission percentage';
COMMENT ON COLUMN EMPLOYEES.MANAGER_ID IS 'Manager id of the employee; has same domain as manager_id in
departments table. Foreign key to employee_id column of employees table.
(useful for reflexive joins and CONNECT BY query)';
COMMENT ON COLUMN EMPLOYEES.DEPARTMENT_ID IS 'Department id where employee works; foreign key to department_id
column of the departments table'; -
How can i improve this code ?
DATA: t_bkpf TYPE bkpf.
DATA: t_bseg type bseg_t.
DATA: wa_bseg like line of t_bseg.
select * from bkpf into t_bkpf where document type ='KZ' and bldat in s_bldat.
select single * from bseg into wa_bseg where belnr = t_bkpf-belnr.
append wa_bseg to t_bseg.
endselect.
loop at t_bseg into wa_bseg.
at new belnr.
if wa_bseg-koart EQ 'K'.
// pick vendor wrbtr
else
// pick other line item's wrbtr
endif.
endat.
endloop.
i am guessing my select statements arnt efficient performance wise, secondly in the loop when i use 'at new belnr' it aint showing my any values whereas i get all the vendors(KOART EQ 'K') when i dont use 'at new belnr' .
why is this so and how can i make the code efficient ?
Thanks..
ShehryarHi,
1.Dont read all the fields from the table unless it is required in your program.
This will tremendously improve your performance.
2.Make use of the key fields of the table wherever possible
In your scenario you could use the fields BUKRS,BELNR,GJAHR of the table BKPF in the WHERE Clause rather than
other fields.This will improve your performance a lot..
3.As BSEG is a cluster table it will cause performance problem in most cases.So try to read
the required fields from it rather than reading all the fields.Again Make use of the key fields in the WHERE Clause
here too to improve the performance..
4.Remove SELECT..ENDSELECT and replace it with FOR ALL ENTRIES to improve the performance.
Cheers,
Abdul Hakim
Mark all useful answers.. -
How can i know how to redeem the code? how can i get this code?
how can i know how to redeem the code? how can i get this code? please i need you help
<Email Edited by Host>You are trying to create a new Apple ID? You don't have one yet? Is that correct?
If so, then see this article on how to creat your Apple ID - and make up a password for it. Remember to write it down immediately.
http://support.apple.com/en-us/HT203993 -
How can i rewrite this code into java?
How can i rewrite this code into a java that has a return value?
this code is written in vb6
Private Function IsOdd(pintNumberIn) As Boolean
If (pintNumberIn Mod 2) = 0 Then
IsOdd = False
Else
IsOdd = True
End If
End Function
Private Sub cmdTryIt_Click()
Dim intNumIn As Integer
Dim blnNumIsOdd As Boolean
intNumIn = Val(InputBox("Enter a number:", "IsOdd Test"))
blnNumIsOdd = IsOdd(intNumIn)
If blnNumIsOdd Then
Print "The number that you entered is odd."
Else
Print "The number that you entered is not odd."
End If
End Sub873221 wrote:
I'm sorry I'am New to Java.Are you new to communication? You don't have to know anything at all about Java to know that "I have an error," doesn't say anything useful.
I'm just trying to get you to think about what your post actually says, and what others will take from it.
what does this error mean? what code should i replace and add? thanks for all response
C:\EvenOdd.java:31: isOdd(int) in EvenOdd cannot be applied to ()
isOdd()=true;
^
C:\EvenOdd.java:35: isOdd(int) in EvenOdd cannot be applied to ()
isOdd()=false;
^
2 errors
Telling you "what code to change it to" will not help you at all. You need to learn Java, read the error message, and think about what it says.
It's telling you exactly what is wrong. At line 31 of EvenOdd.java, you're calling isOdd(), with no arguments, but the isOdd() method requires an int argument. If you stop ant think about it, that should make perfect sense. How can you ask "is it odd?" without specifying what "it" is?
So what is this all about? Is this homework? You googled for even odd, found a solution in some other language, and now you're just trying to translate it to Java rather than actually learning Java well enough to simply write this trivial code yourself? -
Can you optimize this code with bit shifting?
Hi there,
I was wondering if anyone could make this code run faster, by implementing bitshifting techniques. I'd really appreciate it, and thanks!
public void scaleImage(Image source, Image dest) {
int sourceWidth = source.getWidth();
int sourceHeight = source.getHeight();
int thumbWidth = dest.getWidth();
int thumbHeight = dest.getHeight();
Graphics g = dest.getGraphics();
int dx, dy = 0;
for (int y = 0; y < thumbHeight; y++) {
for (int x = 0; x < thumbWidth; x++) {
g.setClip(x, y, 1, 1);
dx = x * sourceWidth / thumbWidth;
dy = y * sourceHeight / thumbHeight;
g.drawImage(source, x - dx, y - dy, Graphics.LEFT | Graphics.TOP);
}Message was edited by:
conlanriosyour method reminds me this stuff:
http://www.java-tips.org/java-me-tips/midp/displaying-images-as-thumbnails-on-j2me-devices.html
you can have a look to this article:
http://developers.sun.com/techtopics/mobility/reference/techart/design_guidelines/image_resizing.html -
I have an ipad mini. From one moment to another a document that was created and used on pages app ( on the ipad mini) does not want to open ( When pressed it states " document cant be opened). How can I make this document open again?
I have tried back ups and restoring, resetting, and even updating the pages app. And nothing has worked.I have an ipad mini. From one moment to another a document that was created and used on pages app ( on the ipad mini) does not want to open ( When pressed it states " document cant be opened). How can I make this document open again?
I have tried back ups and restoring, resetting, and even updating the pages app. And nothing has worked. -
I'm new to mac. Just started out. Have OS 10.8.3. I have an HP 1315 printer. It prints and copies, wont scan. I see old threads on this, nothing recent. ?can i make this work, or do i need a new printer??
Hi Newbie111
I see that you are unable to scan with the Photosmart 1315.
What driver are you using?
The driver listed in the url below is a basic print driver that will allow you to print only.
http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=ps242muc&c c=us&dlc=en&lc=en&os=1006&product=61956&sw_lang=
You can try using the apple drivers in the url below.
http://support.apple.com/kb/DL907
If you have any further issues please let me know. -
How do I make this code generate a new pro when the "NEXT" button is pushed
How do I make this code generate a new set of problem when the "NEXT" Button is pushed
* To change this template, choose Tools | Templates
* and open the template in the editor.
/* Figure out how to create a new set of problms
* Type a list of specifications, include a list of test cases
* DONE :]
package javaapplication1;
import java.awt.GridLayout;
import java.awt.Window;
import javax.swing.*;
import java.awt.event.*;
* @author Baba Akinlolu -
class Grid extends JFrame{
int done = 0;
final int score = 0;
final int total = 0;
//Create Panels
JPanel p2 = new JPanel();
JPanel p3 = new JPanel();
final JPanel p1 = new JPanel();
//Create Radio buttons & group them
ButtonGroup group = new ButtonGroup();
final JRadioButton ADD = new JRadioButton("Addition");
final JRadioButton SUB = new JRadioButton("Subtraction");
final JRadioButton MUL = new JRadioButton("Multiplication");
final JRadioButton DIV = new JRadioButton("Division");
//Create buttons
JButton NEXT = new JButton("NEXT");
JButton END = new JButton("End");
//Create Labels
JLabel l1 = new JLabel("First num");
JLabel l2 = new JLabel("Second num");
JLabel l3 = new JLabel("Answer:");
JLabel l4 = new JLabel("Score:");
final JLabel l5 = new JLabel("");
JLabel l6 = new JLabel("/");
final JLabel l7 = new JLabel("");
//Create Textfields
final JTextField number = new JTextField(Generator1());
final JTextField number2 = new JTextField(Generator1());
final JTextField answer = new JTextField(5);
Grid(){
setLayout(new GridLayout(4, 4, 2 , 2));
p2.add(ADD);
p2.add(SUB);
group.add(ADD);
group.add(SUB);
group.add(MUL);
group.add(DIV);
p2.add(ADD);
p2.add(SUB);
p2.add(DIV);
p2.add(MUL);
//Add to panels
p1.add(l1);
p1.add(number);
p1.add(l2);
p1.add(number2);
p1.add(l3);
p1.add(answer);
p1.add(l4);
p1.add(l5);
p1.add(l6);
p1.add(l7);
p3.add(NEXT);
p3.add(END);
//Add panels
add(p2);
add(p1);
add(p3);
//Create Listners
Listeners();
void Listeners(){
NEXT.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int answer1 = 0;
//Grab the numbers entered
int numm1 = Integer.parseInt(number.getText());
int numm2 = Integer.parseInt(number2.getText());
int nummsanswer = Integer.parseInt(answer.getText());
//Set the score and total into new variabls
int nummscore = score;
int nummtotal = total;
//Check if the add radio button is selected if so add
if (ADD.isSelected() == true){
answer1 = numm1 + numm2;
//otherwise check if the subtract button is selected if so subtract
else if (SUB.isSelected() == true){
answer1 = numm1 - numm2;
//check if the multiplication button is selected if so multiply
else if (MUL.isSelected() == true){
answer1 = numm1 * numm2;
//check if the division button is selected if so divide
else if (DIV.isSelected() == true){
answer1 = numm1 / numm2;
//If the answer user entered is the same with th true answer
if (nummsanswer == answer1){
//add to the total and score
nummtotal += 1;
nummscore += 1;
//Convert the input back to String
String newscore = String.valueOf(nummscore);
String newtotal = String.valueOf(nummtotal);
//Set the text
l5.setText(newscore);
l7.setText(newtotal);
//Otherwise just increase the total counter
else {
nummtotal += 1;
String newtotal = String.valueOf(nummtotal);
l7.setText(newtotal);
//Create End listener
END.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// get the root window and call dispose on it
Window win = SwingUtilities.getWindowAncestor(p1);
win.dispose();
//new Grid();
String Generator1(){
int randomnum;
randomnum = (1 + (int)(Math.random() * 100));
String randomnumm = String.valueOf(randomnum);
return randomnumm;
public class Main {
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
JFrame frame = new Grid();
frame.setTitle("Flashcard Testing");
frame.setSize(500, 200);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}Edited by: SirSaula on Dec 7, 2009 10:17 AMNot only are you continuing to post in the wrong forum but now you are multiposting: [http://forums.sun.com/thread.jspa?threadID=5418935]
If people haven't answered you other posting its probably because we don't understand the question. Quit cluttering the forum by asking the same question over and over and then next time you have a new question post it in the proper forum. Your first posting was moved becuase you didn't post it properly. -
I keep Mail open on my MacBook Pro and prior to Mavericks items would open on my 27" secondary display. How can I make this happen in Mavericks?
In System Preferences > Mission Control, uncheck mark Displays have seperate windows. This should bring you back to the secondary display you had before the upgrade. You may have to open Mail, the first time and place it on your secondary display. You also won't have the advantages of the dock and menus on the secondary display.
I keep my own secondary display with these settings because I need the ability to expand a window across both displays. -
I have a iPad and I connect it to my tv through hdmi but would like the sound to come out through the headphone socket, can I make this happen.
Go to System Preferences>Sound>Output and make sure that you selected the right output. I think if yo use HDMI you might not be abe to select another output.
-
When filling out a form, some fields copy to others when I tab to the next. How can I make this stop?
You can't using Adobe Reader. It looks like whomever created the form used the same identifiers (names) for various fields. Each field with the same name will populate with the information used in another field of the same name. This is intentional.
Normally when I see this, it tells me that someone created an initial field then copy/pasted it to make additional fields but forgot to change the names.
Maybe you are looking for
-
Hi Gurus I am working on BI 7.0 and when I create transformation I have the following message. R<b>ule 5 (target: Z_REV): Target parameter 0008 is not being used</b> <b>Rule (target field: Z_REV): No source field assigned</b> <b>Rule 7 (target: Z_MPR
-
Can't access a website at all...
Hi. First - I was not sure where to post this, since the posting website I would've used for internet issues was the one I cannot access... so.... can anyone fully load http://www.dslreports.com/ ? If so, please report the time you were able to load
-
Need help plz with hw!!
Write a program called SortWords. The program prompts the user for the name of an input file. This file contains words, one word per line. The words are in any order. The program sorts all the words in the input file into alphabetical order and write
-
The server appears to be back up!!!
After trying all day, the server seems to be back up. I was able to use Facetime and imessenger with no problems! Hope it works out for everyone
-
Does an item product from Service Request be an ECC or a CRM product?
Hello I am puzzled with item product which is used in a Service Request, mostly for dates, SLA and contract determination. I wonder if I should create this "Investigation" product in an ECC or in a CRM? (of course I assume we are working with scenari