Need help creating an "insert file" to add an attachment to a form? Is this possible?
I am trying to add an "insert file/attachment" field to a form that I'm creating but am having trouble finding information. Is this possible? Please advise.
Thank you!
Hi,
The form with add attachment feature on link http://eslifeline.files.wordpress.com/2009/04/addattachments.pdf
works fine but when I copy paste objects to use 2-3 times on page 2 and 3 then after attaching different files at all 3 sections, I see only same type of files when using view attachments. I understand it is same like when making 2 fields name same act same together.
Please help me make the javascript run differently (as new) for each add attachment function.
Thanks
Similar Messages
-
Need help creating folders and files in Pathfinder
Hi, I have tried the Pathfinder forum but it's a ghost town over there. I don't know if this is a PF or Finder issue yet.
I've just installed Pathfinder 5.2.2 on an iMac running OS 10.5.8 at my new job.
The problem is I can open files and folders from within Pathfinder but I can't create any new files or folders from within Pathfinder, and I also can't drag anything from the drop stack to a new location either. I've made sure to set permissions for read/write on my Mac HD and on the PF application itself, and I've repaired my permissions, and also run Cocktail, restarted the mac, quit PF etc. Still nothing.
Anything that could point me in the right direction would be greatly appreciated.Hi Kappy,
When I try to move a folder or file, or create one, nothing happens at all. It's as if I never did anything. I am able to open files from within Pathfinder and navigate my Hard Drive, but I cannot create or delete files.
I posted on their forum, which is what they suggest. I've used Pathfinder for several years, I have no questions on the actual interface, but I wonder if there might be a permissions issue on this particular mac. -
Need help Creating a translation pattern that adds dial out digits to incoming calls
I came across an article yesterday and it showed the steps how to fix Missed Call/Received Call numbers so that you can dial them from the menu correctly (auto-add a 9, etc.)?
I tried it this morning and came up with this translation pattern:
voice translation-rule 6
rule 1 /^201\(.*\)/ /8\1/
rule 2 /\(..........\)/ /81\1/
voice translation-profile filter_Incoming
translate calling 6
This translation pattern rule 1 adds the dial out character 8 and strips 201 for local calls. Rule 2 adds dial out character 8 and adds 1 for long distance. The purpose of this translation rule is when the ephone receives the phone call the characters 8 and 1 are added so when you quickly need to redial you do not have to edit the number and add 8 for each call.
I tested the translation-rule:
ROUTER-2911#test voice translation-rule 6 9082121231
Matched with rule 2
Original number: 9082121231 Translated number: 819082121231
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
ROUTER-2911#test voice translation-rule 6 2019121231
Matched with rule 1
Original number: 2019121231 Translated number: 89121231
Original number type: none Translated number type: none
Original number plan: none Translated number plan: none
ROUTER-2911#
Issue is I am not sure with my inbound call leg if it can even work. We dial out through the SIP Trunk and the incoming is translated to the AutoAttendant on Cisco Unity Express.
voice translation-rule 1
rule 1 /2015552100/ /2003/
voice translation-profile CUE_Voicemail/AutoAttendant
translate called 1
dial-peer voice 9 voip
description **Incoming Call from SIP Trunk**
translation-profile incoming CUE_Voicemail/AutoAttendant
call-block translation-profile incoming BLOCKED-INCOMING
call-block disconnect-cause incoming call-reject
session protocol sipv2
session target dns:nd01-04.fs.SIPPROVIDER.net
incoming called-number .%
voice-class codec 1
voice-class sip dtmf-relay force rtp-nte
dtmf-relay rtp-nte
no vad
Can what I am trying to do be done with my current setup?Hi patldmart012,
The dial-peer 9 that you have attached will not be affected by following config
voice translation-rule 6
rule 1 /^201\(.*\)/ /8\1/
rule 2 /\(..........\)/ /81\1/
voice translation-profile filter_Incoming
translate calling 6
Because you have not applied the translation profile "filter_incoming" on the dial-peer.
Could you please provide the exact call flow?
Along with that, If you are facing issue with calls on SIP Trunk, please collect following debugs in a logging buffer and attach the file. I will analyse it and will get back to you.
debug voip ccapi inout
debug ccsip message
debug voice translation
Debug h225 asn1 (If H323 involved)
Debug h245 asn1 (If H323 involved)
Debug MGCP Packets (If MGCP involved)
Also provide the running config of the GW.
These are verbose debugs, so please collect them in the following manner:
Router(config)# service sequence
Router(config)# service timestamps debug datetime msec
Router(config)# logging buffered 30000000 7
Router(config)# no logging con
Router(config)# no logging mon
Router# Clear log
Router# term no mon
<Enable debugs, then wait for issue to occur.>
Router# term len 0
<Enable session capture to txt file in terminal program.>
Router# Undebug all
Router# sh log
Once i have the logs, i will analyse it and will get back to you.
Regards,
Mudit Mathur -
I need to create .pst ext . file using java,whi will import in ms outlook
{color:#ff0000}*I need to create .PST extension file using java which will be able to import in ms outlook,and that .pst file will contain root folder (like Personal Folders) and inbox,sent mail*{color}
give me some hint It is essential task .we have to implement code in javaI'm using the thin drivers.
The answer to your question is no, you do not need to create a DSN to connect to Oracle. The Oracle thin driver is all that is required. Your code looks OK to me, I'm assuming that you xxx'd out the IP, and that you are using a real IP in the actual code.
The message you got back is pretty generic, but can indicate that the Oracle database listener isn't available. Perhaps the database is on a different port, or perhaps the listerner isn't running. Perhaps you have the IP address wrong.
So, to be very basic:
1) Can you ping the server you are trying to connect to? This makes sure you are using a valid IP address.
2) Can you connect to the Oracle server from an Oracle client? This makes sure the listener is running properly, and that you know the correct port number and login information (The port number could be in a local or server based TNS file, or available through an Oracle names server. You might try using the program tnsping if it is available on the client for validation.
3) If you can do 1 and 2, then be sure you are using the same connection parameters (server, port userid and password) that worked with 2.
4) Verify that you are using (pointing to) the correct set of Oracle classes for the thin connection. This can be tricky if you have different versions of Oracle on the client then on the server, but is documented on the Oracle website.
5) If everything checks out, you might want to verify that you are using the most recent versions of the thin drivers, including the Oracle patches.
Hope it helps - good luck,
Joel -
Why do we need to create an emergency file?
Please see the link http://help.sap.com/saphelp_47x200/helpdata/en/9f/db95e635c111d1829f0000e829fbfe/content.htm
Why do we need to create an emergency file?user10566312 wrote:
Packages I know are used to group procedures together. But why do we create packages when stored proc alone is sufficient.For the same reason there are units in Pascal. Libraries in C. It allows the encapsulation of functionality as a single entity with a public interface and a private implementation.
It is is standard as far as structured programming goes.
And a single stored procedure is far from sufficient. It cannot have private and public static variables for keeping state. It cannot present a comprehensive and flexible call interface to the caller. It does not support polymorphism. It cannot expose constants and user types. Etc. -
This Adobe muse site file requires a newer version of Adobe Muse. I want to comeback to old version Adobe muse i need help to open my file thanks
Hi,
You may need to design the site again in older version OR may be copy and paste in place from new to old except what is new in the latest version.
Hope that helps!
Kind Regards, -
I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!
You mean an image such as a scanned document?
If that is the case, the file doesn't contain any text for Reader Out Loud to read. In order to fix that, you would need an application such as Adobe Acrobat that does Optical Character Recognition to convert the images to actual text.
You can also try to export the file as a Word document or something else using ExportPDF which I believe offers OCR and is cheaper than Acrobat. -
Need help in laoding flat file data, which has \r at the end of a string
Hi There,
Need help in loading flat file data, which has \r at the end of a string.
I have a flat file with three columns. In the data, at the end of second column it has \r. So because of this the control is going to the beginning of next line. And the rest of the line is loading into the next line.
Can someone pls help me to remove escape character \r from the data?
thanks,
ragHave you looked into the sed linux command? here are some details:
When working with txt files or with the shell in general it is sometimes necessary to replace certain chars in existing files. In that cases sed can come in handy:
1 sed -i 's/foo/bar/g' FILENAME
The -i option makes sure that the changes are saved in the new file – in case you are not sure that sed will work as you expect it you should use it without the option but provide an output filename. The s is for search, the foo is the pattern you are searching the file for, bar is the replacement string and the g flag makes sure that all hits on each line are replaced, not just the first one.
If you have to replace special characters like a dot or a comma, they have to be entered with a backslash to make clear that you mean the chars, not some control command:
1 sed -i 's/./,/g' *txt
Sed should be available on every standard installation of any distribution. At lesat on Fedora it is even required by core system parts like udev.
If this helps, mark as correct or helpful. -
Uber Noob Needs Help Creating website!
I need help creating my webpage: It has a textbox on it were
the user enters a URL and it then redirects the end user to that
URL when they press the GO Button. It also has a check box saying
"Hide my IP", If the end user clicks this box and then clicks go
they will be directed to the website they stateted in the Textbox
but this time it shall mask there IP Address so they can bypass
proxys and surf anonomosly. Please can someone give me some HTML
code i could use for this site or a Link to a website that can give
me the code.I assume the application is connecting to Oracle using an application ID/password. If so, check to see if that user has a private synonyn to the table. If so drop it since you have a public synonym.
Verify that the public synonym is in fact correct. Drop and recreate the public synonym if you cannot select against the synonym name using an ID that can perform select * from inhouse.icltm where rownum = 1. That is if this other user cannot issue select * from icltm where rownum = 1 without an error.
Check that the application ID has the necessary object privileges on the table.
Queries you need
select * from dba_synonyms
where table_owner = 'INHOUSE'
and table_name = 'ICLTM'
You may find both public and private synonms. Either fix or delete. (Some may reference someelses.icltm table if one exists)
select * from dba_tab_privs
where table_name = 'ICLTM'
and owner = 'INHOUSE'
Note - it is possible to create mixed case or lower case object names in Oracle by using double quotes around the name. Do not do this, but do look to see that this was not done.
You could also query dba_objects for all object types that have the object_name = 'ICLTM'
HTH -- Mark D Powell -- -
I need help on bulk inserts....
Hello,
I need help on bulk inserts. I have heard about it but don't know how to do it and how to specify the number of records to be inserted at a time.
Can anyone please help me out?
For example: I would like to insert in my TEST_TABLE a group of data at tha same time...
INSERT INTO TEST_TABLE VALUES ( (1, 'xxx', 'www'), (2, 'yyy', 'hhh'), (3, 'aaa', 'kkk') )
I using Oracle 10g .
Tks!!
Message was edited by:
user532944
Message was edited by:
user532944But I want to insert a group of data at the same time, with one sql instruction...
I don´t know if exists this SQL command...I just know that I can insert
string sqlStmt = "INSERT INTO TESTE VALUES (:x, :x, :x)";
stmt = con->createStatement (sqlStmt);
But and this instruction ?? In MYSql I can do it!!
string sqlStmt = "INSERT INTO TESTE VALUES ((:x, :x, :x), (:x, :x, :x));
Message was edited by:
user532944 -
Hi. I have a Macbook Pro Model 5,5 with one 800 firewire port. I need to create two firewire 800 ports but only have an SD card slot (this is for video interface with 2 cameras). Is this possible or do I have to have an express card slot in order to do this?
Hi Jessica,
No, the SD slot will not work, you need an ExpressCard/34 slot.
I do not know if it works with cameras, but with two or more HDs, if the first one has two FW ports, you can "daisy chain" one or more additional HDs from it. -
New to applescript. need to create a plist file using applescript
Needed some help I need on creatinga plist file below using applescript and I can't make it happen needed some hand on this.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Username</key>
<string>${localAdminUser}</string>
<key>Password</key>
<string>${localAdminPassword}</string>
<key>AdditionalUsers</key>
<array>
<dict>
<key>Username</key>
<string>${userName}</string>
<key>Password</key>
<string>${userPassword}</string>
</dict>
</array>
</dict>
</plist>
I have tis code but it doesn't seems to work.
tell application "System Events"
-- create an empty property list dictionary item
set the parent_dictionary to make new property list item with properties {kind:record}
-- create new property list file using the empty dictionary list item as contents
set the plistfile_path to "~/Desktop/example.plist"
set this_plistfile to ¬
make new property list file with properties {contents:parent_dictionary, name:plistfile_path}
-- add new property list items of each of the supported types
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"Username", value:"${localAdminUser}"}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:list, name:"AdditionalUsers"}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"Username", value:"${localAdminUser}"}
make new property list item at end of property list items of contents of this_plistfile ¬
with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
end tell
The result of the above code will generate a plist file below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdditionalUsers</key>
<array/>
<key>Password</key>
<string>${localAdminPassword}</string>
<key>Username</key>
<string>${localAdminUser}</string>
</dict>
</plist>Hello
You need to create elements at correct container. Like this.
set plist_file to (path to desktop)'s POSIX path & "example.plist"
--set plist_file to "~/desktop/example.plist"
tell application "System Events"
tell (make new property list file with properties {name:plist_file})
make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
tell (make new property list item at end with properties {kind:list, name:"AdditionalUsers"})
tell (make new property list item at end with properties {kind:record})
make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
end tell
end tell
end tell
end tell
Or you may create a record in AppleScript and set the value of plist file at once. Like this.
set plist_file to (path to desktop)'s POSIX path & "example.plist"
--set plist_file to "~/desktop/example.plist"
set dict to ¬
{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} & ¬
{|AdditionalUsers|:{¬
{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} ¬
--set dict to {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}", |AdditionalUsers|:{{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"}}}
tell application "System Events"
tell (make new property list file with properties {name:plist_file})
set value to dict
end tell
end tell
Regards,
H
Message was edited by: Hiroto (PS. Fixed second script so that it uses the original case (uppercase) in key string) -
Need help fast about opening file
hello i have this 2 classes to open file and display it .the open method works fine but when ever i try to open different file it adds the new data and display both . the problem is it not suppose to add the new data to the old list it should only show the new data only ...can any one help thx
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class RoomGUI extends JFrame
private RoomSortedList list;
// Menu items:
private JMenuItem mOpen;
private JMenuItem mSaveAs;
private JMenuItem mExit;
// Displayed regions of the window:
private JTextField messageField;
private JTextArea textArea;
* Constructor for RoomGUI object to set up
* GUI window with menu.
public RoomGUI()
list=new RoomSortedList();
// Components to display on window:
messageField = new JTextField();
messageField.setEditable(false);
textArea = new JTextArea();
textArea.setEditable(false);
// Arrnge components on window:
Container contentPane = getContentPane();
contentPane.add(messageField, BorderLayout.SOUTH);
JPanel centerPanel = new JPanel();
contentPane.add(centerPanel, BorderLayout.CENTER);
centerPanel.setLayout(new GridLayout(1,1));
centerPanel.add(new JScrollPane(textArea));
// Create menu items for the "File" menu:
mOpen = new JMenuItem ("Open");
mSaveAs = new JMenuItem ("SaveAs");
mExit = new JMenuItem ("Exit");
// Create "File" menu:
JMenu fileMenu = new JMenu ("File", /*tearoff =*/ false);
fileMenu.add(mOpen);
fileMenu.add(mSaveAs);
fileMenu.add(mExit);
// Create menu bar:
JMenuBar mainMenuBar = new JMenuBar();
mainMenuBar.add(fileMenu);
// Put menu bar on this window:
setJMenuBar(mainMenuBar);
mOpen.addActionListener( new FileOpener(textArea,list) );
mSaveAs.addActionListener( new FileSaver(list) );
mExit.addActionListener(new Quitter());
// Routine necessities with JFrame windows:
setSize(500, 400);
setLocation(200, 100);
setTitle("Project 4");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
} // constructorfile opener
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FileOpener implements ActionListener
private RoomSortedList list;
private JTextArea textArea=new JTextArea();
private int returnvalue;
private String filename;
private JTextField messageField;
public FileOpener(JTextArea ta,RoomSortedList ls)
this.textArea=ta;
this.list=ls;
public void actionPerformed(ActionEvent e)
list =new RoomSortedList();
messageField = new JTextField();
JFileChooser filechooser = new JFileChooser();
// if a file is selected returnvalue = 0
// else if cancel button is pressed
// returnvalue = 1
returnvalue = filechooser.showOpenDialog(null);
//if open is selected then return filename
if (returnvalue == filechooser.APPROVE_OPTION){
filename = filechooser.getSelectedFile().toString();
// now read the rooms from the file with the name filename
// invoke the readfile method
readFile(filename);
messageField.setText(filename);
}//if
// if cancel is selected then close the filechooser
else if (returnvalue == filechooser.CANCEL_OPTION)
filechooser.cancelSelection();
* Reads room data from a text file.Check if each lines are in valid room
* format, and values. Catches exception errors for any invalid lines or
* values thrown by ParseRoom or Room constructors.
* Valid lines are appended to an sorted linked list.
* @param filename name of file containing
private void readFile(String filename)
JFrame errorD=new JFrame();
String str=null;
Room r=null;
int linenum=0;
TextFileInput Obj=null;
try
Obj = new TextFileInput(filename);
catch (RuntimeException rte)
System.out.println(rte.getMessage());
while (true)
str = Obj.readLine();
linenum++;
if (str==null) break; // to stop reading lines at the end of file
try
r = RoomTextFormat.parseRoom(str);
catch (RoomTextFormatException rtf)
JOptionPane.showMessageDialog(errorD, "Error reading line # " +
linenum + ": " + str + "\n" + rtf.getMessage() + "\n"+
"This line of text has been excluded from the list.",
"Text Format Error", JOptionPane.ERROR_MESSAGE);
continue;
catch (IllegalRoomException ire)
JOptionPane.showMessageDialog(errorD, "Error reading line # " +
linenum + ": " + str + "\n" + ire.getMessage() + "\n" +
"This line of text has been excluded from the list.",
"Room Instantiation Error", JOptionPane.ERROR_MESSAGE);
continue;
list.insert (r);
textArea.setText("");
RoomListIterator MyIterator = list.beginIterating();
int c=1;
while (MyIterator.hasNext())
Room m = MyIterator.next();
textArea.append(c + ": " + m + "\n");
c++;
}//while
}// while (true)
} // readFile()
}i apologize again.thx anyway . heres the code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class RoomGUI extends JFrame
private RoomSortedList list;
// Menu items:
private JMenuItem mOpen;\
// Displayed regions of the window:
private JTextField messageField;
private JTextArea textArea;
* Constructor for RoomGUI object to set up
* GUI window with menu.
public RoomGUI()
list=new RoomSortedList();
// Components to display on window:
messageField = new JTextField();
messageField.setEditable(false);
textArea = new JTextArea();
textArea.setEditable(false);
// Arrnge components on window:
Container contentPane = getContentPane();
contentPane.add(messageField, BorderLayout.SOUTH);
JPanel centerPanel = new JPanel();
contentPane.add(centerPanel, BorderLayout.CENTER);
centerPanel.setLayout(new GridLayout(1,1));
centerPanel.add(new JScrollPane(textArea));
//Create menu items for the "File" menu:
mOpen = new JMenuItem ("Open");
// Create "File" menu:
JMenu fileMenu = new JMenu ("File", /*tearoff =*/ false);
fileMenu.add(mOpen);
// Create menu bar:
JMenuBar mainMenuBar = new JMenuBar();
mainMenuBar.add(fileMenu);
// Put menu bar on this window:
setJMenuBar(mainMenuBar);
mOpen.addActionListener( new FileOpener(textArea,list) );
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
} // constructor
} // class RoomGUIopen file
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FileOpener implements ActionListener
private RoomSortedList list;
private JTextArea textArea=new JTextArea();
private int returnvalue;
private String filename;
private JTextField messageField;
public FileOpener(JTextArea ta,RoomSortedList ls)
this.textArea=ta;
this.list=ls;
public void actionPerformed(ActionEvent e)
list =new RoomSortedList();
messageField = new JTextField();
JFileChooser filechooser = new JFileChooser();
// if a file is selected returnvalue = 0
// else if cancel button is pressed
// returnvalue = 1
returnvalue = filechooser.showOpenDialog(null);
//if open is selected then return filename
if (returnvalue == filechooser.APPROVE_OPTION){
filename = filechooser.getSelectedFile().toString();
readFile(filename);
messageField.setText(filename);
}//if
// if cancel is selected then close the filechooser
else if (returnvalue == filechooser.CANCEL_OPTION)
filechooser.cancelSelection();
private void readFile(String filename)
String str=null;
TextFileInput Obj=null;
Obj = new TextFileInput(filename);
while (true)
str = Obj.readLine(); //
if (str==null) break; // to stop reading lines at the end of file
list.insert (str);
textArea.setText("");
RoomListIterator MyIterator = list.beginIterating();
int c=1;
while (MyIterator.hasNext())
Room m = MyIterator.next();
textArea.append(c + ": " + m + "\n");
c++;
}//while
}// while (true)
} // readFile()
} -
Need help merging these two files togehter
I have the following class files one reads in a file another creates a file, Can somebody help me put the two class files together so i have one file which creates a file and reads it in, as i am stuck as to which bits need to be copied and which bits i only need once.
/////////////////////////////////////////////////Code to create and save data in to file////////////////
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import bank.BankUI;
import bank.*;
public class CreateSequentialFile extends JFrame {
private ObjectOutputStream output;
private BankUI userInterface;
private JButton enterButton, openButton;
private Store store;
private Employee record;
// set up GUI
public CreateSequentialFile()
super( "Creating a Sequential File of Objects" ); // appears in top of gui
// create instance of reusable user interface
userInterface = new BankUI( 9 ); // number of textfields
getContentPane().add( userInterface, BorderLayout.CENTER );
// configure button doTask1 for use in this program
openButton = userInterface.getDoTask1Button();
openButton.setText( "Save to file" );
// register listener to call openFile when button pressed
openButton.addActionListener(
// anonymous inner class to handle openButton event
new ActionListener() {
// call openFile when button pressed
public void actionPerformed( ActionEvent event )
openFile();
} // end anonymous inner class
); // end call to addActionListener
// configure button doTask2 for use in this program
enterButton = userInterface.getDoTask2Button();
enterButton.setText( "Save to file..." );
enterButton.setEnabled( false ); // disable button
// register listener to call addRecord when button pressed
enterButton.addActionListener(
// anonymous inner class to handle enterButton event
new ActionListener() {
// call addRecord when button pressed
public void actionPerformed( ActionEvent event )
addRecord();
} // end anonymous inner class
); // end call to addActionListener
// register window listener to handle window closing event
addWindowListener(
// anonymous inner class to handle windowClosing event
new WindowAdapter() {
// add current record in GUI to file, then close file
public void windowClosing( WindowEvent event )
if ( output != null )
addRecord();
closeFile();
} // end anonymous inner class
); // end call to addWindowListener
setSize( 600, 500 );
setVisible( true );
store = new Store(100);
} // end CreateSequentialFile constructor
// allow user to specify file name
private void openFile()
// display file dialog, so user can choose file to open
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode( JFileChooser.FILES_ONLY );
int result = fileChooser.showSaveDialog( this );
// if user clicked Cancel button on dialog, return
if ( result == JFileChooser.CANCEL_OPTION )
return;
File fileName = fileChooser.getSelectedFile(); // get selected file
// display error if invalid
if ( fileName == null || fileName.getName().equals( "" ) )
JOptionPane.showMessageDialog( this, "Invalid File Name",
"Invalid File Name", JOptionPane.ERROR_MESSAGE );
else {
// open file
try {
output = new ObjectOutputStream(
new FileOutputStream( fileName ) );
openButton.setEnabled( false );
enterButton.setEnabled( true );
// process exceptions from opening file
catch ( IOException ioException ) {
JOptionPane.showMessageDialog( this, "Error Opening File",
"Error", JOptionPane.ERROR_MESSAGE );
} // end else
} // end method openFile
// close file and terminate application
private void closeFile()
// close file
try {
int storeSize = store.getCount();
for (int i = 0; i<storeSize;i++)
output.writeObject(store.elementAt(i));
output.close();
System.exit( 0 );
// process exceptions from closing file
catch( IOException ioException ) {
JOptionPane.showMessageDialog( this, "Error closing file",
"Error", JOptionPane.ERROR_MESSAGE );
System.exit( 1 );
} // end method closeFile
// add record to file
public void addRecord()
int employeeNumber = 0;
String fieldValues[] = userInterface.getFieldValues();
// if account field value is not empty
if ( ! fieldValues[ BankUI.IDNUMBER ].equals( "" ) ) {
// output values to file
try {
employeeNumber = Integer.parseInt(
fieldValues[ BankUI.IDNUMBER ] );
String dob = fieldValues[ BankUI.DOB ];
String[] dateofBirth = dob.split ("-"); // what used to put between number
String sDate = fieldValues[ BankUI.START ];
String[] startDate = sDate.split ("-");
String sex = fieldValues[ BankUI.GENDER ];
char gender = (sex.charAt(0));
if ( employeeNumber >= 0 ) {
record = new Employee(
fieldValues[ BankUI.NAME ],
gender,
new Date( Integer.parseInt(dateofBirth[0]),
Integer.parseInt(dateofBirth[1]),
Integer.parseInt(dateofBirth[2])),
fieldValues[ BankUI.ADDRESS ],
fieldValues[ BankUI.NATINTNO ],
fieldValues[ BankUI.PHONE ],
fieldValues[ BankUI.IDNUMBER ],
new Date( Integer.parseInt(startDate[0]),
Integer.parseInt(startDate[1]),
Integer.parseInt(startDate[2])),
Float.parseFloat( fieldValues[ BankUI.SALARY ] ));
if (!store.isFull())
store.add(record);
else
JOptionPane.showMessageDialog( this, "The Store is full you cannot add\n"+
"anymore employees. \nPlease Save Current File and Create a New File." );
System.out.println("Store full");
store.displayAll();
System.out.println("Count is " + store.getCount());
// output record and flush buffer
//should be written to fuile in the close file method.
output.flush();
else
JOptionPane.showMessageDialog( this,
"Account number must be greater than 0",
"Bad account number", JOptionPane.ERROR_MESSAGE );
// clear textfields
userInterface.clearFields();
} // end try
// process invalid account number or balance format
catch ( NumberFormatException formatException ) {
JOptionPane.showMessageDialog( this,
"Bad ID number, Date or Salary", "Invalid Number Format",
JOptionPane.ERROR_MESSAGE );
// process exceptions from file output
catch ( ArrayIndexOutOfBoundsException ArrayException ) {
JOptionPane.showMessageDialog( this, "Error with Start Date or Date of Birth",
"IO Exception", JOptionPane.ERROR_MESSAGE );
// process exceptions from file output
catch ( IOException ioException ) {
JOptionPane.showMessageDialog( this, "Error writing to file",
"IO Exception", JOptionPane.ERROR_MESSAGE );
closeFile();
} // end if
} // end method addRecord
public static void main( String args[] )
new CreateSequentialFile();
} // end class CreateSequentialFile
/////////////////////////////Code to read and cycle through the file created above///////////
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import bank.*;
public class ReadSequentialFile extends JFrame {
private ObjectInputStream input;
private BankUI userInterface;
private JButton nextButton, openButton, nextRecordButton ;
private Store store = new Store(100);
private Employee employeeList[] = new Employee[100];
private int count = 0, next = 0;
// Constructor -- initialize the Frame
public ReadSequentialFile()
super( "Add Employee" );
// create instance of reusable user interface
userInterface = new BankUI( 9 );
getContentPane().add( userInterface, BorderLayout.CENTER );
// get reference to generic task button doTask1 from BankUI
openButton = userInterface.getDoTask1Button();
openButton.setText( "Open File" );
// register listener to call openFile when button pressed
openButton.addActionListener(
// anonymous inner class to handle openButton event
new ActionListener() {
// close file and terminate application
public void actionPerformed( ActionEvent event )
openFile();
} // end anonymous inner class
); // end call to addActionListener
// register window listener for window closing event
addWindowListener(
// anonymous inner class to handle windowClosing event
new WindowAdapter() {
// close file and terminate application
public void windowClosing( WindowEvent event )
if ( input != null )
closeFile();
System.exit( 0 );
} // end anonymous inner class
); // end call to addWindowListener
// get reference to generic task button doTask2 from BankUI
nextButton = userInterface.getDoTask2Button();
nextButton.setText( "Next Record" );
nextButton.setEnabled( false );
// register listener to call readRecord when button pressed
nextButton.addActionListener(
// anonymous inner class to handle nextRecord event
new ActionListener() {
// call readRecord when user clicks nextRecord
public void actionPerformed( ActionEvent event )
readRecord();
} // end anonymous inner class
); // end call to addActionListener
//get reference to generic task button do Task3 from BankUI
// get reference to generic task button doTask3 from BankUI
nextRecordButton = userInterface.getDoTask3Button();
nextRecordButton.setText( "Get Next Record" );
nextRecordButton.setEnabled( false );
// register listener to call readRecord when button pressed
nextRecordButton.addActionListener(
// anonymous inner class to handle nextRecord event
new ActionListener() {
// call readRecord when user clicks nextRecord
public void actionPerformed( ActionEvent event )
getNextRecord();
} // end anonymous inner class
); // end call to addActionListener
pack();
setSize( 600, 300 );
setVisible( true );
} // end ReadSequentialFile constructor
// enable user to select file to open
private void openFile()
// display file dialog so user can select file to open
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode( JFileChooser.FILES_ONLY );
int result = fileChooser.showOpenDialog( this );
// if user clicked Cancel button on dialog, return
if ( result == JFileChooser.CANCEL_OPTION )
return;
// obtain selected file
File fileName = fileChooser.getSelectedFile();
// display error if file name invalid
if ( fileName == null || fileName.getName().equals( "" ) )
JOptionPane.showMessageDialog( this, "Invalid File Name",
"Invalid File Name", JOptionPane.ERROR_MESSAGE );
else {
// open file
try {
input = new ObjectInputStream(
new FileInputStream( fileName ) );
openButton.setEnabled( false );
nextButton.setEnabled( true );
// process exceptions opening file
catch ( IOException ioException ) {
JOptionPane.showMessageDialog( this, "Error Opening File",
"Error", JOptionPane.ERROR_MESSAGE );
} // end else
} // end method openFile
// read record from file
public void readRecord()
Employee record;
// input the values from the file
try {
record = ( Employee ) input.readObject();
employeeList[count++]= record;
store.add(record);
store.displayAll();
System.out.println("Count is " + store.getCount());
// create array of Strings to display in GUI
String values[] = {
String.valueOf(record.getName()),
String.valueOf(record.getGender()),
String.valueOf( record.getDateOfBirth()),
String.valueOf( record.getID()),
String.valueOf( record.getStartDate()),
String.valueOf( record.getSalary()),
String.valueOf( record.getAddress()),
String.valueOf( record.getNatInsNo()),
String.valueOf( record.getPhone())
// i added all those bits above split onto one line to look neater
// display record contents
userInterface.setFieldValues( values );
// display message when end-of-file reached
catch ( EOFException endOfFileException ) {
nextButton.setEnabled( false );
nextRecordButton.setEnabled( true );
JOptionPane.showMessageDialog( this, "No more records in file",
"End of File", JOptionPane.ERROR_MESSAGE );
// display error message if class is not found
catch ( ClassNotFoundException classNotFoundException ) {
JOptionPane.showMessageDialog( this, "Unable to create object",
"Class Not Found", JOptionPane.ERROR_MESSAGE );
// display error message if cannot read due to problem with file
catch ( IOException ioException ) {
JOptionPane.showMessageDialog( this,
"Error during read from file",
"Read Error", JOptionPane.ERROR_MESSAGE );
} // end method readRecord
private void getNextRecord()
Employee record = employeeList[next++%count];//cycles throught accounts
//create aray of string to display in GUI
String values[] = {String.valueOf(record.getName()),
String.valueOf(record.getGender()),
String.valueOf( record.getStartDate() ), String.valueOf( record.getAddress()),
String.valueOf( record.getNatInsNo()),
String.valueOf( record.getPhone()),
String.valueOf( record.getID() ),
String.valueOf( record.getDateOfBirth() ),
String.valueOf( record.getSalary() ) };
//display record contents
userInterface.setFieldValues(values);
//display record contents
// again i nicked these write them on one line
// close file and terminate application
private void closeFile()
// close file and exit
try {
input.close();
System.exit( 0 );
// process exception while closing file
catch ( IOException ioException ) {
JOptionPane.showMessageDialog( this, "Error closing file",
"Error", JOptionPane.ERROR_MESSAGE );
System.exit( 1 );
} // end method closeFile
public static void main( String args[] )
new ReadSequentialFile();
} // end class ReadSequentialFileI tired putting both codes together and got this, it runs but does not do what i want can anybody help me put the above two codes together as one
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import bank.BankUI;
import bank.*;
public class togehter extends JFrame {
private ObjectOutputStream output;
private BankUI userInterface;
private JButton enterButton, openButton;
//private Store store; wont work if i un comment this
private Employee record;
// from read
private ObjectInputStream input;
private JButton nextButton, openButton2, nextRecordButton ;
private Store store = new Store(100);
private Employee employeeList[] = new Employee[100];
private int count = 0, next = 0;
// end of read
// set up GUI
public togehter()
super( "Creating a Sequential File of Objects" ); // appears in top of gui
// create instance of reusable user interface
userInterface = new BankUI( 9 ); // textfields
getContentPane().add( userInterface, BorderLayout.CENTER );
// configure button doTask1 for use in this program
openButton = userInterface.getDoTask1Button();
openButton.setText( "Save to file" );
// register listener to call openFile when button pressed
openButton.addActionListener(
// anonymous inner class to handle openButton event
new ActionListener() {
// call openFile when button pressed
public void actionPerformed( ActionEvent event )
openFile();
} // end anonymous inner class
); // end call to addActionListener
// from read
// get reference to generic task button doTask1 from BankUI
openButton2 = userInterface.getDoTask1Button();
openButton2.setText( "Open File" );
// register listener to call openFile when button pressed
openButton2.addActionListener(
// anonymous inner class to handle openButton2 event
new ActionListener() {
// close file and terminate application
public void actionPerformed( ActionEvent event )
openFile();
} // end anonymous inner class
); // end call to addActionListener
// from read end
// from read
// register window listener for window closing event
addWindowListener(
// anonymous inner class to handle windowClosing event
new WindowAdapter() {
// close file and terminate application
public void windowClosing( WindowEvent event )
if ( input != null )
closeFile();
System.exit( 0 );
} // end anonymous inner class
); // end call to addWindowListener
//from read end
// from read
// get reference to generic task button doTask2 from BankUI
nextButton = userInterface.getDoTask2Button();
nextButton.setText( "Next Record" );
nextButton.setEnabled( false );
// register listener to call readRecord when button pressed
nextButton.addActionListener(
// anonymous inner class to handle nextRecord event
new ActionListener() {
// call readRecord when user clicks nextRecord
public void actionPerformed( ActionEvent event )
readRecord();
} // end anonymous inner class
); // end call to addActionListener
//get reference to generic task button do Task3 from BankUI
// get reference to generic task button doTask3 from BankUI
nextRecordButton = userInterface.getDoTask3Button();
nextRecordButton.setText( "Get Next Record" );
nextRecordButton.setEnabled( false );
// register listener to call readRecord when button pressed
nextRecordButton.addActionListener(
// anonymous inner class to handle nextRecord event
new ActionListener() {
// call readRecord when user clicks nextRecord
public void actionPerformed( ActionEvent event )
getNextRecord();
} // end anonymous inner class
); // end call to addActionListener
// from read end
// configure button doTask2 for use in this program
enterButton = userInterface.getDoTask2Button();
enterButton.setText( "Save to file..." );
enterButton.setEnabled( false ); // disable button
// register listener to call addRecord when button pressed
enterButton.addActionListener(
// anonymous inner class to handle enterButton event
new ActionListener() {
// call addRecord when button pressed
public void actionPerformed( ActionEvent event )
addRecord();
} // end anonymous inner class
); // end call to addActionListener
// register window listener to handle window closing event
addWindowListener(
// anonymous inner class to handle windowClosing event
new WindowAdapter() {
// add current record in GUI to file, then close file
public void windowClosing( WindowEvent event )
if ( output != null )
addRecord();
closeFile();
} // end anonymous inner class
); // end call to addWindowListener
setSize( 600, 500 );
setVisible( true );
store = new Store(100);
} // end CreateSequentialFile constructor
// allow user to specify file name
private void openFile()
// display file dialog, so user can choose file to open
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode( JFileChooser.FILES_ONLY );
int result = fileChooser.showSaveDialog( this );
// if user clicked Cancel button on dialog, return
if ( result == JFileChooser.CANCEL_OPTION )
return;
File fileName = fileChooser.getSelectedFile(); // get selected file
// display error if invalid
if ( fileName == null || fileName.getName().equals( "" ) )
JOptionPane.showMessageDialog( this, "Invalid File Name",
"Invalid File Name", JOptionPane.ERROR_MESSAGE );
else {
// open file
try {
output = new ObjectOutputStream(
new FileOutputStream( fileName ) );
openButton.setEnabled( false );
enterButton.setEnabled( true );
// process exceptions from opening file
catch ( IOException ioException ) {
JOptionPane.showMessageDialog( this, "Error Opening File",
"Error", JOptionPane.ERROR_MESSAGE );
} // end else
} // end method openFile
// from read
public void readRecord()
Employee record;
// input the values from the file
try {
record = ( Employee ) input.readObject();
employeeList[count++]= record;
store.add(record);/////////ADDS record to Store
store.displayAll();
System.out.println("Count is " + store.getCount());
// create array of Strings to display in GUI
String values[] = {
String.valueOf(record.getName()),
String.valueOf(record.getGender()),
String.valueOf( record.getDateOfBirth()),
String.valueOf( record.getID()),
String.valueOf( record.getStartDate()),
String.valueOf( record.getSalary()),
String.valueOf( record.getAddress()),
String.valueOf( record.getNatInsNo()),
String.valueOf( record.getPhone())
// display record contents
userInterface.setFieldValues( values );
// display message when end-of-file reached
catch ( EOFException endOfFileException ) {
nextButton.setEnabled( false );
nextRecordButton.setEnabled( true );
JOptionPane.showMessageDialog( this, "No more records in file",
"End of File", JOptionPane.ERROR_MESSAGE );
// display error message if class is not found
catch ( ClassNotFoundException classNotFoundException ) {
JOptionPane.showMessageDialog( this, "Unable to create object",
"Class Not Found", JOptionPane.ERROR_MESSAGE );
// display error message if cannot read due to problem with file
catch ( IOException ioException ) {
JOptionPane.showMessageDialog( this,
"Error during read from file",
"Read Error", JOptionPane.ERROR_MESSAGE );
} // end method readRecord
//from read end
// from read
private void getNextRecord()
Employee record = employeeList[next++%count];//cycles throught accounts
//create aray of string to display in GUI
String values[] = {String.valueOf(record.getName()),
String.valueOf(record.getGender()),
String.valueOf( record.getStartDate() ), String.valueOf( record.getAddress()),
String.valueOf( record.getNatInsNo()),
String.valueOf( record.getPhone()),
String.valueOf( record.getID() ),
String.valueOf( record.getDateOfBirth() ),
String.valueOf( record.getSalary() ) };
//display record contents
userInterface.setFieldValues(values);
//display record contents
// from read end
// close file and terminate application
private void closeFile()
// close file
try {
int storeSize = store.getCount();
for (int i = 0; i<storeSize;i++)
output.writeObject(store.elementAt(i));
output.close();
input.close(); // from read
System.exit( 0 );
// process exceptions from closing file
catch( IOException ioException ) {
JOptionPane.showMessageDialog( this, "Error closing file",
"Error", JOptionPane.ERROR_MESSAGE );
System.exit( 1 );
} // end method closeFile
// add record to file
public void addRecord()
int employeeNumber = 0;
String fieldValues[] = userInterface.getFieldValues();
// if account field value is not empty
if ( ! fieldValues[ BankUI.IDNUMBER ].equals( "" ) ) {
// output values to file
try {
employeeNumber = Integer.parseInt(
fieldValues[ BankUI.IDNUMBER ] );
String dob = fieldValues[ BankUI.DOB ];
String[] dateofBirth = dob.split ("-"); // what used to put between number chnage to /
String sDate = fieldValues[ BankUI.START ];
String[] startDate = sDate.split ("-");
String sex = fieldValues[ BankUI.GENDER ];
char gender = (sex.charAt(0)); // check if m or f prob check in employee
if ( employeeNumber >= 0 ) {
record = new Employee(
fieldValues[ BankUI.NAME ],
gender,
new Date( Integer.parseInt(dateofBirth[0]),
Integer.parseInt(dateofBirth[1]),
Integer.parseInt(dateofBirth[2])),
fieldValues[ BankUI.ADDRESS ],
fieldValues[ BankUI.NATINTNO ],
fieldValues[ BankUI.PHONE ],
fieldValues[ BankUI.IDNUMBER ],
new Date( Integer.parseInt(startDate[0]),
Integer.parseInt(startDate[1]),
Integer.parseInt(startDate[2])),
Float.parseFloat( fieldValues[ BankUI.SALARY ] ));
if (!store.isFull())
store.add(record);
else
JOptionPane.showMessageDialog( this, "The Store is full you cannot add\n"+
"anymore employees. \nPlease Save Current File and Create a New File." );
System.out.println("Store full");
store.displayAll();
System.out.println("Count is " + store.getCount());
output.flush();
else
JOptionPane.showMessageDialog( this,
"Account number must be greater than 0",
"Bad account number", JOptionPane.ERROR_MESSAGE );
// clear textfields
userInterface.clearFields();
} // end try
// process invalid account number or balance format
catch ( NumberFormatException formatException ) {
JOptionPane.showMessageDialog( this,
"Bad ID number, Date or Salary", "Invalid Number Format",
JOptionPane.ERROR_MESSAGE );
// process exceptions from file output
catch ( ArrayIndexOutOfBoundsException ArrayException ) {
JOptionPane.showMessageDialog( this, "Error with Start Date or Date of Birth",
"IO Exception", JOptionPane.ERROR_MESSAGE );
// process exceptions from file output
catch ( IOException ioException ) {
JOptionPane.showMessageDialog( this, "Error writing to file",
"IO Exception", JOptionPane.ERROR_MESSAGE );
closeFile();
} // end if
} // end method addRecord
public static void main( String args[] )
new togehter();
} // end class CreateSequentialFileI GOT IT WORKING BUT THERE WAS A WEIRD ERROR I GET WHEN TRYING TO READ A FILE I JUST WROTE THE THREAD FOR THAT CAN BE FOUND:
http://forum.java.sun.com/thread.jspa?threadID=5147209
Message was edited by:
ajrobson -
Aperture Workflow - need help creating workflow for photo management
Hi -
I currently shoot with a Canon SD890 (point & shoot) and a Nikon D300 (SLR). My photography is either personal photography or street photography. I may use some of my photography for a web project but that should not be considered right now. I shoot jpegs with the SD890 and RAW with the D300. I need to create a workflow that will allow me to manage all of my photos as well as the RAW vs JPEG aspect. Here are a few initial questions:
1) Should I separate the RAW and JPEGs in Aperture (two libraries)? One library for finished photos and one for negatives?
2) What folder structure should I use? Since I am not a professional photographer, I won't be shooting projects. I think something date or event driven would be best (preferably both).
I am interested to hear how others do this...especially if you use both point & shoot and SLR cameras.
Thanks for your help!jnap818 wrote:
1) Should I separate the RAW and JPEGs in Aperture (two libraries)? One library for finished photos and one for negatives? I am interested to hear how others do this...especially if you use both point & shoot and SLR cameras.
No, use a single Library. Aperture will have no problems with the various formats or with various different cameras.
2) What folder structure should I use? Since I am not a professional photographer, I won't be shooting projects. I think something date or event driven would be best (preferably both).
Actually those date or event driven batches of images are very logically "Projects" in Aperture. Simply name each group of images as you import into AP as a new Project.
IMO it is not good to import camera-to-Aperture (or direct to any app other than the Finder). Best is to use a card reader and use the Finder to copy images from the camera card to a folder on the computer hard drive.
Below is my Referenced-Masters workflow:
• Remove the CF card from the camera and insert it into a CF card reader. Faster readers and cards are preferable.
• Finder-copy images from CF to a labeled folder on the intended permanent Masters location hard drive. I label that folder with the Project name suffixed with _masters, that way I can always find the Masters if Aperture forgets where they are.
• Eject CF.
• Burn backup copies of the original images to DVDs or to hard drives (optional backup step).
• Eject backup DVDs/hard drives (optional backup step).
• From within Aperture, import images from the hard drive folder into Aperture selecting "Store files in their current location."
• Review pix for completeness (e.g. a 500-pic shoot has 500 valid images showing).
• Reformat CF in camera, and archive DVDs of originals off site.
Note that the "eject" steps above are important in order to avoid mistakenly working on removable media.
I strongly recommend that every Aperture user spend $35 and work through the tutorial CD Apple Pro Training Series: Aperture 2 (Apple Pro Training Series) by Ben Long, Richard Harrington, and Orlando Luna (Paperback - May 8, 2008), Amazon.com. Note that the value is in working the tutorial, not in using the book as a manual.
Good luck!
-Allen Wicks
Maybe you are looking for
-
Installation of Developer Suite 10g in Linux
Hi, I've done the configuration of Developer Suite 10g on Windows OS. But i want to know how can i configure the Developer Suite 10g in Linux platform. Any link for this would help me a lot. I have done some configuration, but i'm facing some problem
-
Hi All, I currently have a scenario where I receive an IDoc, then need to make an RFC call to another R/3 system to get some additional data, and then transform and send the resulting message out to another system. There is a possible case where the
-
XI pro not in drop down list for serial number verification
I have installed XI pro and am directed to the serial number upgrade page. XI pro is not on the drop down list and when I enter my serial number it tells me its not for the qualifying product when i try to use any of the XI drop downs. ???
-
MacBookPro external video with bootcamp issue
I need some help figuring out how to use an external DVI monitor while running bootcamp xp pro. I have connected a monitor and an external keyboard and tried rebooting with it connected and also just closing the laptop, but cannot get any video to ap
-
Image UI element is not displayed in Abap webdynpro application
Hi Experts, I need your advice on below issue. I have created new ABAP Webdynpro application just to display employee photo. When loading the application, I generated a dynamic URL for a image in webdynpro application path in cache to map to Image UI