Pulling one record out of a ArrayCollection
I have a query coming back from CF and into an
ArrayCollection.
public function petListHandler(e:ResultEvent):void {
petData = e.result as ArrayCollection;
How can I display one field of data? I.E. In CF, it would be
recordsetname.fieldname
"Greg Lafrance" <[email protected]> wrote in
message
news:g7sj98$skk$[email protected]..
> getItemAt(index:int, prefetch:int = 0):Object
>
> You might need to do this:
>
> getItemAt(getItemIndex(myObject))
If you already have the object, you don't need to use
getItemAt to get it
Similar Messages
-
Pulling one worksheet out of workbook
I have a workbook that goes back about 6 years to when we were on desktop. It has grown to around 30 worksheets. There are 2 worksheets that I would like to make its own workbook. In desktop, all I had to do was select the worksheet and "pull" it right out to another workbook or to the desktop where it created a new workbook. Since in disco plus I can only have one workbook open at a time, is there an easy way to do make another workbook or do I have to rename this workbook and go delete worksheet 30 times? Also, if I wanted to add another worksheet to this new workbook from a different workbook, is the only way to do this is to recreate the wheel in the new workbook?
Thanks.
Oracle BI Discoverer 11g (11.1.1.6.0)
Oracle Business Intelligence Discoverer Plus 11g (11.1.1.6.0)
Discoverer Model - 11.1.1.6.0
Discoverer Server - 11.1.1.6.0
End User Layer - 5.1.1.0.0.0
End User Layer Library - 11.1.1.6.0
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionI asked out IT guy and they pulled the plug on desktop so that is not an option. What I did instead of rename and delete, I scheduled the report with just the tabs I wanted and saved that as my new workbook. Plus has some nice functions that desktop didn't have, mainly being able to export the query and then using excel to refresh my data without going back into discoverer.... learned that on my own. But I still say plus is a step back in time. Oh well...
Thanks. -
SQL query requested to pull one field out of multiple records
Post Author: ralph.devlin
CA Forum: Data Connectivity and SQL
We use Track IT to manage our ticket base. We have parent work orders and child assignments that I am trying to report on. What I want to do is create a view, or even if this can be done in a formula, is pull data from the main work order, which in our scnerio and accorindg to the database diagrapm is WORKORDERTYPEID = 0, It will pull the TASKS.RESPONS field from that WO. Then it will compare the TASKS.PARETNWOID to WOID and if WORKORDERTYPEID = 1 then it needs to return the TASKS/RESPONS field of that record, and there may be three records or so. Then What I may need it to do is organize it maybe into seperate columns so I can add each one to Crystal keeping in mind that it will need to link those records to main WOID of the parent so it will display on one line. Any ideas
RalphPost Author: ralph.devlin
CA Forum: Data Connectivity and SQL
Ok I tried that and it seemed to work fine, here is an aexample of the data returned
168458
Lane, Carrie
Ralph Devlin
Ralph Devlin
168458
PHX - Training Room
SM - 8th Fl Conf Room
NULL
NULL
168458
6/20/2008 3:30:00 PM
Video Conference
0
168458
Lane, Carrie
Ralph Devlin
Luis Estrada
168458
PHX - Training Room
SM - 8th Fl Conf Room
NULL
NULL
168458
6/20/2008 3:30:00 PM
Video Conference
1
Using the last column which is the workordertypeid, I was able to elimate the first row of data, which is the parent work order, but see how it is returning the technician name twice, where the second row returns me as the primary and then the technician on the assignment WO as well, which I want. In Crystal I have it only selecting the rows with the 1 is the last column, since those rows have the data arranged how I want them to be.
Once issue that just arose, is what if we only had one work order that we wanted to report on in the subreport. since the WO will get a 0 in the last column, it will never be selected in the report. Is there a way to either us a statement that selects it if it is the only WO listed compared by the WOID field, or if there is a way in SQL, to get what is showing in row 2 to be the only row returned back so I can then show all work orders regardless if they are an assignment
Here is my current SQL query
SELECT T1.WOID, T1.REQUEST, T1.RESPONS, T2.RESPONS AS Addtech, T2.PARENTWOID, T1.LOOKUP2, T1.TaskLookup3, T1.TaskLookup4, T1.TaskLookup5, T1.WO_NUM, T1.DUEDATE, T1.WOTYPE3, T2.WorkOrderTypeIdFROM dbo.TASKS AS T1 LEFT OUTER JOIN dbo.TASKS AS T2 ON T2.PARENTWOID = T1.WOID -
How to delete one record out the two?
Hi all,
A have an Orders table:
ACCOUNT, ORDER_NO, ORDER_DATE
I have a few cases where there two accounts have the same ORDER_NO. I dont think this is right in a traditional Orders/ Orderline relationship!
For Example:
ACCOUNT ORDER_NO ORDER_DATE
WYM01 O15506 01/09/2004
DA4060 O15506 01/09/2004
What is the best way to delete one of these? There are quiet a few so I was looking into cursors.
ThanksYou can do it like this
DELETE
FROM orders
WHERE ROWID IN ( SELECT row_id
FROM (SELECT ROWID row_id
,ROW_NUMBER () OVER ( PARTITION BY order_no
ORDER BY ROWID
) row_num
FROM orders
WHERE row_num <> 1
);Regards
Arun -
How to return more than one record through OUT parameter in procedure
Hi,
I want to create a procedure which accepts one input and returns more than one record as output.
example:
Input = DeptNo
Output= Empno,ename,sal,comm,job
Scenario:
There can be more than one employee in department we pass as the IN parameter. OUT parameter has to return all the records of the corresponding employee details in that department.
Thanks in advance for your help
Regards,
K.Vijay-- I think you can try something like this using ref cursor:
-- create a package for the type ref cursor and execute
CREATE OR REPLACE PACKAGE PACK_REFCURSOR_FOR_TABLES AS
TYPE DATA_TableRows IS REF CURSOR;
END;
-- after executing the package above, create your procedure:
CREATE OR REPLACE PROCEDURE GET_EMP (
IN_nDeptNo IN number,
OUT_Emp OUT PACK_REFCURSOR_FOR_TABLES.DATA_TableRows)
IS
BEGIN
-- leave query open (implicit) as this will return data
OPEN OUT_Emp FOR
SELECT *
FROM tblEmp
WHERE DeptNo = IN_nDeptNo;
END;
--execute the procedure and you're done -
Get more the one records in procedure by using out parameter
Hi good evening every body,
how to get more the one records in procedure by using out parameter ,
give me one example of it.
regards
subbaLike this ?
SQL> set serverout on
SQL> declare
2 v_empno dbms_sql.Number_Table;
3 v_ename dbms_sql.Varchar2_Table;
4 PROCEDURE P1(p_in_deptno IN emp.deptno%TYPE,
5 p1_out OUT dbms_sql.Number_Table,
6 p2_out OUT dbms_sql.Varchar2_Table) IS
7 BEGIN
8 SELECT empno, ename BULK COLLECT
9 INTO p1_out, p2_out
10 FROM emp
11 WHERE deptno = p_in_deptno;
12 END;
13 BEGIN
14 P1(20, v_empno, v_ename);
15 FOR i in 1 .. v_ename.COUNT LOOP
16 dbms_output.put_line(v_empno(i) || '--' || v_ename(i));
17 END LOOP;
18 END;
19 /
7369--SMITH
7566--JONES
7788--SCOTT
7876--ADAMS
7902--FORD
7941--ABCDEFGHIJKLMNOPQRSTUVWXYZAAAAAA
7942--MY#@ ' "ABC
PL/SQL procedure successfully completed.
{code} -
I can't pull a value out of a list from CFDIRECTORY.
I've avoided insanity all these years, but this issue finally has me on the brink. My institutionalization is in your hands.
I'm trying to get the name of a specific directory from the list of directories generated by CFDIRECTORY action="list". But everything I try, fails in one way or another. Bascially, I can't pull the value out of the structure -- even though the code DOES FIND the value -- because it thinks the value is supposed to be a field or key. (The server is running CF8.)
These lines of code work fine:
<!--- Make and loop through List of local directories. --->
<CFSET LocalDirectoryList = "">
<CFDIRECTORY action="list" name="LocalDirectoryList" TYPE="dir" directory="#PathOfLocalFolderToCopyToRemoteFolders#">
<CFIF IsDefined("LocalDirectoryList.RecordCount") AND LocalDirectoryList.RecordCount GT "0">
<CFLOOP query="LocalDirectoryList">
Now comes the killer. I want to define a variable whose value is the name of the current local directory -- that is, the value of LocalDirectoryList.Name for each loop of the loop. But if I try to Access LocalDirectoryList.Name as a simple string variable, the way I usually can for a query string variable --
<CFSET ThisLocalDirectory = LocalDirectoryList.Name>
-- I get a message, "You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members."
On the other hand, if I treat "LocalDirectoryList.Name" as a structure, and try to destructure it with any of the following --
1) <CFSET ThisLocalDirectory = Evaluate(LocalDirectoryList.Name)>
2) <CFSET ThisLocalDirectory = "#Evaluate(LocalDirectoryList.Name)#">
3) <CFSET ThisLocalDirectory = "#StructFind(LocalDirectoryList, Name)#">
4) <CFSET ThisLocalDirectory = StructFind(LocalDirectoryList, Name)>
5) <CFSET ThisLocalDirectory = "#Evaluate(StructFind(LocalDirectoryList, Name))#">
I get either "Variable backgrounds is undefined" (for 1 or 2) or "The specified key, backgrounds, does not exist in the structure" (for 3, 4 or 5) .
As it happens, the name of that directory is "backgrounds". So the value I'm looking for DOES EXIST in the structure "LocalDirectoryList". And the code IS FINDING IT. But it thinks its the NAME of a key, instead of the VALUE of the key.
Note: Adding the attribute, listInfo="Name", to the CFDIRECTORY tag restricts the returned fields, or keys, to "Name", but LocalDirectoryList.Name is still a structure, and I still get the same results.
Will I be the next cuckoo in the cuckoo's nest? Or can you save me, and keep me sane? My fate is in your hands.
Thank you!But it thinks its the NAME of a key, instead of the VALUE of the key.
Because that what the code is instructing CF to do ;-)
<CFSET ThisLocalDirectory = StructFind(LocalDirectoryList, Name)>
If you want to search for the literal string "Name" it must be enclosed in quotes. Otherwise you are instructing CF to treat it as a variable and to pass its value (ie "backgrounds") into structFind(). The same thing with evaluate().
<CFIF IsDefined("LocalDirectoryList.RecordCount") AND LocalDirectoryList.RecordCount GT "0">
However as Michael pointed out, there is rarely a need for evaluate, and under normal circumstances no need for that IsDefined either. The query should always exist and the loop will only execute if the query contains one or more records. So the code could be reduced to this.
<CFDIRECTORY action="list"
name="LocalDirectoryList"
type="dir"
directory="#PathOfLocalFolderToCopyToRemoteFolders#">
<CFLOOP query="LocalDirectoryList">
<CFSET ThisLocalDirectory = LocalDirectoryList.Name>
</CFLOOP>
Note, there is technically no need to assign #LocalDirectoryList.Name# to another variable either. It can be used directly. -
How can I display more than one record with result set meta data?
Hi,
My code:
ArrayList<String> resultList = new ArrayList<String>();
rs=ps.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
while(rs.next()){
for(int k=1;k<=rsmd.getColumnCount();k++){
resultList.add(rs.getString(k));
ps.close();
}catch(Exception e){
e.printStackTrace();
return resultList;
public String test(ArrayList result)throws Exception{
String data=
"<tr>"+
"<td class=normalFont>"+result.get(0)+"</td>"+
"<td class=normalFont>"+result.get(1)+"</td>"+
"</tr>";
return data;
} All the things are wroking but the problem is that ArrayList is displaying just one record whereas I have more than 20 records to display. I tried with loop like: i<result.size(); and result.get(i) then its throwing exception
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 I stuck here for the last more than 2 days. Please help me
Best regardsRaakh wrote:
Still waiting .....I would have answered much earlier, but when I saw this little bit of impatience, I decided to delay answering for a while.
ArrayList<String> list = new ArrayList<String>();
list.add("abc");
list.add("def");
list.add("ghi");
System.out.println(list.get(0));
abc
System.out.println(list.get(1));
def
System.out.printnln(list);
[abc, def, ghi]That list has 3 items. Each one is a String.
But here is what you appear to be doing:
select * from person
+-----+-------------+-------------+--------+
| id | first name | last name | height |
+-----+-------------+-------------+--------+
| 1 | Joe | Smith | 180 |
+-----+-------------+-------------+--------+
| 2 | Mary | Jones | 144 |
+-----+-------------+-------------+--------+
for each row in ResultSet {
for each column in ResultSet {
list.add(that element);
// which becomes
list.add(1);
list.add("Joe");
list.add("Smith");
list.add(180);
list.add(2);
list.add("Mary");
list.add("Jones");
list.add(144);
System.out.println(list.get(0));
1
System.out.println(list.get(1));
Joe
System.out.printlN(list);
[1, Joe, Smith, 180, 2, Mary, Jones, 144]That list has 8 items. Some of them are Strings and some of them are Integers. I would assume that, for this sample case, you would want a list with 2 items, both of which are Person objects. However, it really isn't clear from your posts what you are trying to do or what difficulty you're having, so I'm just guessing. -
I am pulling my hair out! I am using adobe indesign and just want to make a text box 'autofit text' as I change fonts a lot and want the font to automatically re-size as I change it.
Is it not possible to create a text box, fill it with dynamic (data driven) text, but make the font size either scale up or down automatically, so that the entire text box is filled? This is a feature in PrintShop Mail Pro called COPY FIT. but no such feature in Indesign??
help help help please - I have latest version of indesign - thanks, DJlol... it seems to work, but I have another huge problem!
Apparently .CSV files cannot contain page breaks in the data! The data I am trying to merge is a 'letter', with paragraphs, line breaks, etc.,
But, after data merging, it ignores page breaks and only merges the first paragraph of each letter. (sigh)
Solution? Hopefully, an EASY solution. lol as we have thousands of records.
Is there a third party indesign plugin that will allow .xml, or .xls data merge import??
Thx,
DJ -
Challenge involving creating a file on GUI & seeing one record at a time...
Hi,
If anyone can help me with this project I'd be most appreciative. I'll try and explain the problem the best I can. I'm adding students to a database at a university they're either a Graduate or an Undergraduate. I'm taking in first, lastname's, ssn, & ACT/SAT/GMAT test results. I have a GUI called StudentRecord that has all the JTextFields, JButton's, etc. I'm also writing it to a .txt file called StudentDA. For this I used a BufferedFile reader.
What I really need is on my StudentRecord when I click the display button I want it to show one record at a time in another JFrame. This other JFrame I named it display. I'm trying to create an instance of JFrame inside of the actionPerformed for StudentRecord but when I click display nothing happens.
I adding the students with a vector that I'm calling v. I want the Display to read from the .txt file and display one at a time hence next, and previous. I'm going to post the tidbit of relevant code. If anyone can help me you'd be my hero for the day for all time I've tried to get this to work.
Here's the StudentRecord (GUI) display part:
public void actionPerformed( ActionEvent event )
try {
Display d = new Display(StudentDA.v);
}//end try
//catch right here no problems with this..Here's the DataAccess part:
public class StudentDA{
static Vector v = new Vector();;
static String pathName = "a:/Final Project/test1.txt";
static File studentFile = new File(pathName);
static String status;
public StudentDA() {}
public static void initialize() {
if (studentFile.exists() && studentFile.length() !=0) {
try{
BufferedReader in = new BufferedReader(new
FileReader(studentFile) );
do{
status = in.readLine();
if(status.equals ("uGrad")) {
uGrad u = new uGrad();
u.setFName(in.readLine() );
u.setLName(in.readLine() );
u.setssNum(Integer.parseInt(in.readLine()) );
u.setACT(Integer.parseInt(in.readLine() ));
v.add(u);
System.out.println(u + "inside ugrad");
}//end if uGrad
else{
if(status.equals("Grad")) {
//same process as uGrad
v.add(g);
}//end else Grad
}while (status != null);
}//end try statement
catch (Exception e) {
}//end catch
}//end if there's something there
}//end method initialize
//creating the terminate method
public static void terminate() {
try{
PrintStream out = new PrintStream ( new
FileOutputStream (studentFile) );
for (int i = 0; i < v.size(); i++) {
Student s = (Student) v.elementAt(i);
String p = s.printRecord();
StringTokenizer rt = new StringTokenizer(p, "\t");
while (rt.hasMoreTokens() ) {
out.println(rt.nextToken() );
}//end while
}//end for loop
}//end try loop
catch (Exception e){
}//end catch
}//end terminate
public static void add(Student s){// throws DuplicateException{
boolean duplicate = false;
for(int i = 0; i < v.size(); i++){
if(s.getssNum() == ((Student)(v.elementAt(i))).getssNum()){
duplicate = true;
break;
if(duplicate){
throw new DuplicateException("Student Already Exists");
else{
v.add(s);
}//end add method
}//end classHere's the display class:
public class Display extends JFrame {
private JButton Next, Previous;
private JTextField statusField, firstField, lastField, socialField, advPlacementField, actField;
private JLabel statusLabel, firstLabel, lastLabel, socialLabel, advPlacementLabel, actLabel;
private JPanel fieldPanel, buttonsPanel;
private JTextArea displayArea;
static int count = 0;
static String status;
public Display(){}
public Display(Vector v){
//setting up the GUI components for the display class here
//JTextAreas & JLabels
buttonsPanel = new JPanel();
buttonsPanel.setLayout(new GridLayout(1,2));
Next = new JButton("Next");
buttonsPanel.add(Next);
Next.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event )
//try to catch display errors
try {
count++;
displayData(count);
//displayData();
}//end try
catch {
}//end catch
} // end actionPerformed
} // end anonymous inner class
); // end call to addActionListener
buttonsPanel.add(Next);
Previous = new JButton("Previous");
buttonsPanel.add(Previous);
Previous.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event )
//try to catch display errors
try {
count--;
displayData(count);
//displayData();
}//end try
catch {
}//end catch
} // end actionPerformed
} // end anonymous inner class
); // end call to addActionListener
}//end display() constructor
public void displayData(int count) {
StudentDA.initialize();
if (status.equals ("uGrad")) {
//these are all part of the StudentRecord GUI not Display GUI
fieldPanel.setVisible(true);
buttonsPanel.setVisible(true);
actLabel.setVisible(true);
actField.setVisible(true);
advPlacementLabel.setVisible(false);
advPlacementLabel.setVisible(false);
}//end if
else {
if(status.equals ("Grad")) {
fieldPanel.setVisible(true);
buttonsPanel.setVisible(true);
actLabel.setVisible(false);
actField.setVisible(false);
advPlacementLabel.setVisible(true);
advPlacementLabel.setVisible(true);
}//end if
}//end else
}//end method displayData()
public static void main ( String args[] )
Display application = new Display();
application.addWindowListener(
new WindowAdapter(){
public void windowClosing( WindowEvent e)
System.exit(0);
application.setSize( 300, 200);
application.setVisible( true );
};//end main
}//end class Display{}I know this is long but if anyone can help I'd greatly appreciate it. Please ask me if you need me to clarify something, I tried to not make it way too long. --rockbottom01
I'm not really too sure what it is that you are after, but here is some code, that loads up an array with each line of a .txt file, then displays them. I hope you can make use of a least some of it.
just ask if you don't understand any of the code.
String array[];
int i;
public Test() {
readFile("file.txt");
i = 0;
nextEntry();
public void nextEntry() {
Display display = new Display();
display.show();
class Display extends JFrame implements ActionListener {
JLabel label1;
JButton button;
public Display() {
label1 = new JLabel(array);
button = new JButton("OK");
getContentPane().setLayout(new FlowLayout());
getContentPane().add(label1);
getContentPane().add(button);
button.addActionListener(this);
public void actionPerformed(ActionEvent e) {
setVisible(false);
i++;
if(i < array.length) {
nextEntry();
public void readFile(String fileName) {
String s, s2 = "";
int lineCount = 0;
BufferedReader in;
try {
in = new BufferedReader(new FileReader(fileName));
while((s = in.readLine()) != null) {
lineCount++;
array = new String[lineCount];
in.close();
in = new BufferedReader(new FileReader(fileName));
int j = 0;
while((s = in.readLine()) != null) {
array[j] = s;
j++;
catch(IOException e) {
System.out.println("Error"); -
I am getting only one record from table data
Hi Experts,
I am using interacive forms to bring the table data i used GET_STATIC_ATTRIBUTES_TABLE
method. initially the table is empty when i fill some records more than one it is giving me only one record.
where as i fill the table in wddoinit more than one record and try to retreived it, showing all the records more than one. waht is the reason.. if i fill manually why it is not bringing all the reocrds.
i have used the cardinatly as follows
1. parent node(no tables/structure used)
Dictionary structure empty not used
Cardinality 1..1
Selection 0..1
Initialization Lead Selection Checked
Singleton Not checked
Supply Function not used
2. table node(i used table type)
Dictionary structure SFLIGHT_LIGHT
Cardinality 1..n
Selection 0..n
Initialization Lead Selection Checked
Singleton Not checked
Supply Function not used
Pleae help me out...
Thanks,
Mahesh.Gattuhi,
Use the following code for making the rows editable for a table UI element.
DATA lo_nd_cn_try TYPE REF TO if_wd_context_node.
DATA lo_el_cn_try TYPE REF TO if_wd_context_element.
DATA ls_cn_try TYPE wd_this->element_cn_try.
DATA ls_cn_try1 TYPE wd_this->elements_cn_try.
navigate from <CONTEXT> to <CN_TRY> via lead selection
lo_nd_cn_try = wd_context->get_child_node( name = wd_this->wdctx_cn_try ).
do 5 times.
clear ls_cn_try.
append ls_cn_try to ls_cn_try1.
lo_nd_cn_try->bind_table( ls_cn_try1 ).
enddo.
-> cn_try is the node which is binded with the Table UI element.
What all this is called as initialization of table. This code will make 5 rows editable, If u want more rows editable then run the loop according to the requirement.
U can write this code in the WDDOINIT.
Thanks,
Pankaj Aggarwal. -
I tried to add this in the topic already open but it kept sending me through the unending rabbit holes!
My question is: How do I figure out what release I was on, get rid of this one and got back to a functional firefox that moves in realtime. I already did all the reset and etc.... I just want to go back to the speed I had. This halting , hanging up misery of a browzer is Sad. I have had firefox for years and always recommended it ..... BUT NOT ANY MORE. I agree with the other poster ... there should be a rollback feature. Peoples time has value and right now FireFox is sucking the value down a rabbit hole.
See Below Comment Feedback submitted before I finally got here:
This new version of FireFox is making me nutz! It is SUCKING 100% CPU time almost constantly. I could just pull my hair out. I wpdated once a month or so ago and it slowed down..... but the latest update before I did the reset really slowed me down. I came here to fix it a couple of dayz ago and did the reset firefox and now it IS RUNNING SO POORLY AND SLOW I AM ABOUT TO KILL IT OFF MY MACHINE!!! Yes that is me yelling - and it happened in SSSSSSSSSSSSS LLLLLLLLL OOOOOOOO WWWWWWWWWW Motion. I have run all the security scans and cleanups ---this needs a fix ASAP!!! PS: The hang ups and slowness is EVERYWHERE I go. I only get speed doing programs not connected to ON LINE.Hello,
The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
To Reset Firefox do the following:
#Go to Firefox > Help > Troubleshooting Information.
#Click the "Reset Firefox" button.
#Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
#Firefox will open with all factory defaults applied.
Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
Did this fix your problems? Please report back to us!
Thank you. -
Pulling a program out of the IDE
I have been playing with pulling small progrograms out of my Integrated development environment (IDE); writing them to CD; and installing them on other desktops, just as an exercise in the case I want to deliver some applications to a friend.
The overall requirements(steps) are not clear to me.
1.the directory organization
2. the file (jar) creation
3. the D0S (java.exe) window
Are some of the issue that come to mind.
I have been able to use a desktop icon and set the path to a program.class file and run it--making the program window appear but the java.exe Dos window also appears.
So far, the number of texts I have give no step by step instructions on how to configure an environment without an IDE with the java VM already intalled, or how to pull a program out of the IDE and install it along with a copy of the VM on another machine.Good question. Lot's of people don't know this, and I can't even say I have all the right answers. There are probably numerous ways you could do this. The best way, if you have the money, is to buy something like InstallAnywhere or Wise that provide professional installations. Not only will your install look like professional installation of stuff like Photoshop, etc but it will also handle issues like OS platform specifics, environment variables, registry entires (if possible), the proper JRE/JDK installed... if not install it, uninstallation features, and so forth. That is by far the best way to go.
However, often you just want to bundle something up and send it out to a few friends, family, etc. You could of course look for an open source or freeware utitlity and no doubt there are some out there. Or, you could do what a lot of people do now, use the Ant tool (written in Java) and have a build script that does everything for you. I have a simple template build script that is used for various tasks. In our work setup, it does local dev (incremental) compiles, and if necessary packaging it up into .jar/.zip files. My single build script can also run junit tests and reports, builds executable packages into .zip and .jar's as necessary, will do a clean build (great for making sure any code changes don't break some code elsewhere, thus ensuring that your normal incremental build process is not missing something), it can FTP or copy files to locations, it can email results, and so forth. If you don't know about ant, I STRONGLY suggest you learn it quickly, and to me there is no better way than buy the book Java Development with Ant. Two of the main Ant developers/committers wrote the book and it does an excellent job of teaching you about all the different uses of Ant, including the template build script I now use. It is well worth the $40 or so you'll find the book for, and within a week you'll have a good build template that you can modify for specific projects.
Now, in terms of the 3 things, well, the directory organization is always changing. Each project may have something different, but here is one that I usually use:
<root project dir>: (below this you'll find)
/src - location of all src files
/src/java - the location of the project specific java code
/src/examples - if need be (especially useful for frameworks and API's you wish to share) show example applications using the output of the /src/java code
/src/test - location of JUnit, jfcUnit and other test files to unit test your code (very important, should be done no matter what!!)
/lib - location of any 3rd party libraries you need, both for compilation and runtime. Keep in mind that your build script may pull only a subset of these libraries in for runtime. For example, the /src/test that uses JUnit will require the junit.jar file. You won't need this for runtime, so your build script sets up a compile classpath with junit.jar, and a runtime classpath that will exclude junit.jar, perhaps others.
/dist - the location that the build script puts all distributable files. This would be any executable .jar file, any .zip file, perhaps other files necessary for distribution. If you were making a large application and planned to burn it to disk, instead of a single .zip file, you may actually build the sub-dirs below the /dist/<your app> type of dir, so that you can simply burn from that <your app> dir to the root of the cd.
/build - location of all compiled classes, including from /src/java, /src/examples, /src/test.
/build/classes - the location of compiled java code
/build/test - the location of test results, including perhaps test data to be used by the test code, and possibly the output dir of test reports
- /build/test/reports for example for output of test reports.
/doc - location of any documentation, including the JavaDoc produced by the build script from your src.
<project root> - this is the location of your build.xml ant build script, if need be. The build script, as you would learn in the book, is set up so that you can move it anywhere and it will still build your project correctly. You may opt to put it in the /scripts dir instead and keep the project root super clean.
/misc or /etc - common location to put things like properties files, misc files used to build projects. For example, in the building of a EJB application (.jar or .ear file), you will no doubt need the META-INF/application.xml file. Or in a .jar file you need a special META-INF/manifest.mf file. The /misc or /etc dir is a good candidate for these types of things. You can even package it up in your app so that in the .jar file you have /etc/properties/somepropertyfile.properties, and in your code do a simple getClass().getClassLoader().getResource("/etc/properties/somepropertyfile.properties") to always ensure you pull it from this directory. OR, your build script can "change" the location this file goes. It is all up to you.
That is what I use for all my projects, the dir structure anyway. What you do to build your .jar/.zip files is up to you. You usually don't need to pull the /src dir, the /dist dir, etc into your .jar/.zip files. Normally you'll have the compiled classes at the root. So in your project dir on your disk, you may have <project root>/build/classes/java/org/mycompany/ui/Main.class, and in your .jar file it would simply be <root of .jar file>/org/mycompany/ui/Main.class, and your build file can easily "change" the root path (using <zipfileset prefix=""> task) to change the path of any file. But more of that can be learned in that book and by looking up resources on the net. The Ant JavaDoc API is very good at explaining most of these as well, and there are TONS of ant scripts in most projects to look at for examples.
The file creation, well, as I said Ant has built in tasks you can use to create .jar files, .zip files, etc. All of that is all built in to how Ant works.
As for java.exe, well, in a professional app, you usually do one of two things. You either write a simple C/C++/Delphi/some other languages .exe wrapper (for windows) that internall executes the java.exe and runs the JVM to hide the window, as well as provide a .exe file to look more "native", or you run javaw.exe, which hides the Console output window for most apps. NOTE: if you create a .bat shortcut on your desktop to javaw.exe, you will STILL get a console window that shows up. ALL shortcuts to .bat files will always create a console window. Many java developers don't understand why they run javaw.exe from a shortcut on their desktop and still see the console window.
Now, hopefully that helped a bit. But if not, or you still have questions, I am watching this thread so fire away and I'll help more. -
Select query on QALS table taking around 4 secs to fetch one record
Hi,
I have one select query that takes around 4 secs to fetch one record. I would like to know if there are any ways to reduce the time taken for this select.
SELECT
b~prueflos
b~matnr
b~lagortchrg
a~vdatum
a~kzart
a~zaehler
a~vcode
a~vezeiterf
FROM qals AS b LEFT OUTER JOIN qave AS a ON
bprueflos = aprueflos
INTO TABLE t_qals1
FOR ALL ENTRIES IN t_lgorts
WHERE matnr = t_lgorts-matnr
AND werk = t_lgorts-werks
AND lagortchrg = t_lgorts-lgort
AND stat35 = c_x
AND art IN (c_01,c_08).
When I took the SQL trace, here I found other details :
Column No.Of Distinct Records
MANDANT 2
MATNR 2.954
WERK 30
STAT34 2
HERKUNFT 5
Analyze Method Sample 114.654 Rows
Levels of B-Tree 2
Number of leaf blocks 1.126
Number of distinct keys 16.224
Average leaf blocks per key 1
Average data blocks per key 3
Clustering factor 61.610
Also note, This select query is using INDEX RANGE SCAN QALS~D.
All the suggestions are welcome
Regards,
VijayaHi Rob,
Its strange but, the table t_lgorts has only ONE record
MATNR = 000000000500003463
WERK = D133
LAGORTCHRG = 0001
I have also seen that for the above criteria the table QALS has 2266 records that satisfy this condition.
I am not sure..but if we write the above query as subquery instead of Outer join..will it improve the performance?
Will check it from my side too..
Regards,
Vijaya -
Insert more than one record in a transaction is costly or insert big record
Hi,
I am using Oracle 10g on linux 64 bit
Could anybody tell me that currently my log tables in oracle has 22 columns out of 22, 20 belongs to rate from different lenders like
uuid,app id,lender1,lender2,lender3 .............,lender20
1,123,lender1_rate,lender2_rate,lender3_rate..............
In order to make it more readable and in order to include new lender dynamically we are changing this table to row wise so that we do not need to include new lender column in table
uuid,app,lender
1,123,lender1_rate
1,123,lender2_rate
1,123,lender3_rate
1,123,lender20_rate
but it will create instead of one record, 20 records for each app in a transaction.
Is it costly for insert. If it is then what should be the way.Hi,
It could be slightly costly to insert.
But it makes my design more flexible and my queries less costly and flexible.
I would use something like this as my columns.
uuid, app, lender_code, lender_rate
Regards
Anurag.
Maybe you are looking for
-
Error While updating C2-03 Software
Getting error while updating software. Error code is 12052
-
How do I add text to a secured document?
In my business I use a lot of e-signatures. When I get an e-signed document (they are secure), I need to add my clients responses to the document, then get my clients e-signatures and then send it back to the other party. How can add my comments to a
-
My mother gave me her old ipod since she has an iphone. I reset the ipod and signed in under my apple id but the ipod tells me I can't download my previous purchase music because I have to wait 90 days. What can I do instead of waiting 90 days to u
-
HI I WOULD LIKE TO KNOW HOW TO PASS NEGATIVE VALUE TO AN INTERNAL TABLE FIELD IN DIALOG PROGRAM. I HAVE TABLE CONTROL IN THAT WHOLE INTERNAL TABLE FIELDS ARE INPUT AND OUT ENABLED,, BUT IT IS NOT ALLOWING NEGATIVE VALUES IN FIELDS. WHAT TO DO TO TAKE
-
Restore from Backup without saving
How do I stop iTunes from saving an additional backup when I am restoring to backup on a new iPhone. It takes up alot of space and I do not have enough, hence the process stops after some time.