Delete Method in AM
Dear Experts
I am new to OAF. I Created a simple Employee Page which gives result based Search. I added a Delete Item in the page and when i press delete Icon, I am calling the following Code in AM
public void deleteEmp(String pAction ,String pEmpno) {
EmpVOImpl vo = getEmpVO1();
Row row[] = vo.getAllRowsInRange();
System.out.println(row.length);
for(int i=0; i<row.length; i++) {
EmpVORowImpl rowi = (EmpVORowImpl)row;
if(rowi.getEmpno().toString().equals(pEmpno)) {
rowi.remove();
getOADBTransaction().commit();
return;
I noticed that, the row[] is not picking any records in VO. So it is not executing the for Loop. Please advise if i am missing any of the steps here.
Thanks
Ahmed
Hi Guru
This helped me. I used the following code and it is working perfectly!!!
public void deleteEmp(String pAction ,String pEmpno) {
System.out.println("Inside the AM");
//throw new OAException("Inside AM",OAException.INFORMATION);
EmpVOImpl vo = (EmpVOImpl)findViewObject("EmpVO1");
vo.clearCache();
// vo.setMaxFetchSize(0);
vo.executeQuery();
Row row[] = vo.getAllRowsInRange();
// System.out.println(vo.getFetchedRowCount());
// System.out.println(row.length);
for(int i=0; i<row.length; i++) {
EmpVORowImpl rowi = (EmpVORowImpl)row;
System.out.println(rowi.getEmpno());
if(rowi.getEmpno().toString().equals(pEmpno)) {
rowi.remove();
getOADBTransaction().commit();
break;
throw new OAException("Employee Successfully Deleted",OAException.INFORMATION);
Thanks for your response!!!
--Ahmed
Similar Messages
-
Please Help Me, Delete Method(any suggestions!!)
Can anyone spare the time to look at the below three classes and suggest a method that goes into the customerList class and deletes a record from the Oracle DB they are sitting on top of.
For example when the deleteCust button is pressed on the form (customerForm) I would like it to delete the current customer (currentCustomer) that is displayed on the form at the time of the button click.
Can anyone please HELP me, it would be very much appreciated :-)
customer class
import java.util.*;
import java.sql.*;
public class Customer{
private int customer_id;
private String customer_name;
private String address1;
private String address2;
private String town;
private String county;
private String post_code;
private String country;
private String fax;
private String telephone;
private String contact_name;
private String email;
private boolean newCustomer;
//private JobList jobList;
public Customer(int c){
customer_id = c;
newCustomer = true;
public Customer(int inCustomer_id,String inCustomer_name,String inAddress1, String inAddress2, String inTown, String inCounty,String inPost_code,String inCountry,String inFax,String inTelephone,String inContact_name,String inEmail){
customer_id=inCustomer_id;
customer_name=inCustomer_name;
address1=inAddress1;
address2=inAddress2;
town=inTown;
county=inCounty;
post_code=inPost_code;
country=inCountry;
fax=inFax;
telephone=inTelephone;
contact_name=inContact_name;
email=inEmail;
newCustomer = false;
public String getAddress1(){
if (address1 == null)
return ("");
else
return address1;
public String getAddress2(){
if (address2 == null)
return ("");
else
return address2;
public String getCounty(){
if (county == null)
return ("");
else
return county;
public String getFax(){
if (fax == null)
return ("");
else
return fax;
public int getCustomer_id(){
if (customer_id == 0)
return (0);
else
return customer_id;
public String getCustomer_name(){
if (customer_name == null)
return ("");
else
return customer_name;
public String getTelephone(){
if (telephone == null)
return ("");
else
return telephone;
public String getPost_code(){
if (post_code == null)
return ("");
else
return post_code;
public String getTown(){
if (town == null)
return ("");
else
return town;
public String getCountry(){
if (country == null)
return ("");
else
return country;
public String getContact_name(){
if (contact_name == null)
return ("");
else
return contact_name;
public String getEmail(){
if (email == null)
return ("");
else
return email;
/*public JobList getJobList() throws SQLException {
// if the joblist object exists return it otherwise create it
if (jobList != null){
return jobList;
else{
return new JobList(this);
public boolean isNewCustomer(){
return newCustomer;
public void setAddress1(String inAddress1){
address1=inAddress1;
public void setAddress2(String inAddress2){
address2=inAddress2;
public void setCounty(String inCounty){
county=inCounty;
public void setFax(String inFax){
fax=inFax;
public void setCustomer_id(int inCustomer_id){
customer_id = inCustomer_id;
public void setCustomer_name(String inCustomer_name){
customer_name=inCustomer_name;
public void setTelephone(String inTelephone){
telephone=inTelephone;
public void setPost_code(String inPost_code){
post_code=inPost_code;
public void setTown(String inTown){
town=inTown;
public void setCountry(String inCountry){
country=inCountry;
public void setContact_name(String inContact_name){
contact_name=inContact_name;
public void setEmail(String inEmail){
email=inEmail;
customerList class
import java.sql.*;
import java.util.*;
public class CustomerList{
private ResultSet rs ;
private Connection con;
private Statement stmt;
public CustomerList () {
ConnectionManager man = ConnectionManager.getInstance();
con = man.getConnection();
public Customer getFirstCustomer()throws SQLException {
Customer firstCustomer;
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery("select customer_id,customer_name,address1,address2,town,county,post_code,country,fax,telephone,contact_name,email from customer");
rs.next();
firstCustomer = loadCustomer();
return firstCustomer;
public Customer getLastCustomer() throws SQLException{
Customer lastCustomer;
rs.last();
lastCustomer = loadCustomer();
return lastCustomer;
public Customer getNextCustomer()throws SQLException{
Customer nextCustomer ;
if (rs.next()){
nextCustomer = loadCustomer();
else{
nextCustomer = null;
return nextCustomer;
public Customer getPreviousCustomer()throws SQLException{
Customer previousCustomer;
if (rs.previous()){
previousCustomer = loadCustomer();
else
previousCustomer = null;
return previousCustomer;
public Customer findCustomer(int inCustNum) throws SQLException{
Customer foundCust;
if (inCustNum==0){
foundCust = getFirstCustomer();
else{
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery("select customer_id,customer_name,address1,address2,town,county,post_code,country,fax,telephone,contact_name,email from customer where customer_id = "+inCustNum);
if (rs.next()){
foundCust = loadCustomer();
else
foundCust = null;
return foundCust;
public Customer addCust()throws SQLException{
Statement stmt2 = con.createStatement();
ResultSet rsadd = stmt2.executeQuery("select custid.nextval from dual");
rsadd.next();
int id = rsadd.getInt("nextval");
rsadd.close();
stmt2.close();
Customer newCust = new Customer(id);
return newCust;
public Customer saveCustomer(Customer inSaveCust)throws SQLException{
Statement stmt3 = con.createStatement();
int rowNum;
//int incid = inSaveCust.getCid();
if (inSaveCust.isNewCustomer()){
stmt3.executeUpdate("insert into customer values ("
+inSaveCust.getCustomer_id()
+",'"+inSaveCust.getCustomer_name()
+"','"+inSaveCust.getAddress1()
+"','"+inSaveCust.getAddress2()
+"','"+ inSaveCust.getTown()
+"','"+ inSaveCust.getCounty()
+"','"+inSaveCust.getPost_code()
+"','"+inSaveCust.getCountry()
+"','"+inSaveCust.getFax()
+"','"+ inSaveCust.getTelephone()
+"','"+inSaveCust.getContact_name()
+"','"+inSaveCust.getEmail()+"')");
inSaveCust = getFirstCustomer();//refreshes list after insert
inSaveCust = getLastCustomer();// goes to the inserted record ie last one
else {
rowNum = rs.getRow();//traps the record number so can be returned to
stmt3.executeUpdate("update customer set customer_name = '"+inSaveCust.getCustomer_name()
+ "', address1 = '"+inSaveCust.getAddress1()
+ "', address2 = '"+inSaveCust.getAddress2()
+ "', town = '"+ inSaveCust.getTown()
+ "', county = '"+ inSaveCust.getCounty()
+ "', post_code = '"+inSaveCust.getPost_code()
+ "', telephone = '"+inSaveCust.getCountry()
+ "', fax = '"+inSaveCust.getFax()
+ "', country = '"+inSaveCust.getTelephone()
+ "', contact_name = '"+inSaveCust.getContact_name()
+ "', email = '"+inSaveCust.getEmail()
+"' where customer_id = "+inSaveCust.getCustomer_id());
inSaveCust = getFirstCustomer();
rs.absolute(rowNum); // points back to same record number as updated
inSaveCust = loadCustomer();
con.commit();
return inSaveCust;
//Trying to add in the delete method here(as u can see it is not working)
/*public Customer deleteCustomer() throws SQL Exception {
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt4.executeQuery("delete from customer where customer_id = "Integer.parseInt(textCustomer_id.getText()));
rs.next();
firstCustomer = loadCustomer();
return firstCustomer;
public boolean isFirst() throws SQLException{
return rs.isFirst();
public boolean isLast() throws SQLException{
return rs.isLast();
public Customer loadCustomer ()throws SQLException{
Customer cust = new Customer(rs.getInt("customer_id"),rs.getString("customer_name"),rs.getString("address1"),
rs.getString("address2"),rs.getString("town"),rs.getString("county"),
rs.getString("post_code"),rs.getString("country"),rs.getString("fax"),
rs.getString("telephone"),rs.getString("contact_name"),rs.getString("email"));
return cust;
customerForm class
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
public class CustomerForm extends JFrame implements ActionListener {
private Customer currentCustomer;
private CustomerList inCustomerList;
private JPanel panel;
private JTextField textCustomer_id,textCustomer_name,textAddress1,textAddress2,textTown,
textCounty,textPost_code,textCountry,textTelephone,textFax,textContact_name,textEmail,textFind;
private JButton nextCust, prevCust,firstCust,lastCust,newCust,
findCust,add,save,delete,jobs,close,deleteCust;
public CustomerForm(CustomerList inC)throws SQLException{
inCustomerList = inC;
currentCustomer = inCustomerList.getFirstCustomer();
displayForm();
displayFields();
setTextFields();
displayButtons();
getContentPane().add(panel);
setVisible(true);
public void displayForm() throws SQLException{
setTitle("Customer Form");
setSize(700,500);
// Center the frame
Dimension dim = getToolkit().getScreenSize();
setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);
getContentPane().setLayout(new BorderLayout());
Border etched = BorderFactory.createEtchedBorder();
panel = new JPanel();
panel.setLayout( null );
Border paneltitled = BorderFactory.createTitledBorder(etched,"");
panel.setBorder(paneltitled);
panel.setBackground(new Color(224,224,255));
public void displayFields() throws SQLException{
int x = 10;
int y = 50;
int textheight = 20;
int textwidth = 150;
int labelwidth = 110;
int ydist = textheight + 10;
int xdist = textwidth*2;
JLabel labelCustomer_id = new JLabel("Customer Number:");
labelCustomer_id.setBounds( x, y, labelwidth, textheight);
panel.add(labelCustomer_id);
JLabel labelCustomer_name = new JLabel("Customer Name:");
labelCustomer_name.setBounds(xdist, y, labelwidth, textheight);
panel.add(labelCustomer_name);
JLabel labelAddress1 = new JLabel("Address 1:");
labelAddress1.setBounds( x, y+ydist, labelwidth, textheight);
panel.add(labelAddress1);
JLabel labelAddress2 = new JLabel("Address 2:");
labelAddress2.setBounds( xdist, y+ydist, labelwidth, textheight);
panel.add(labelAddress2);
JLabel labelTown = new JLabel("Town:");
labelTown.setBounds(x, y+ydist*2, labelwidth, textheight);
panel.add(labelTown);
JLabel labelCounty = new JLabel("County:");
labelCounty.setBounds(xdist, y+ydist*2, labelwidth, textheight);
panel.add(labelCounty);
JLabel labelPost_code = new JLabel("Post Code:");
labelPost_code.setBounds(x, y+ydist*3, labelwidth, textheight);
panel.add(labelPost_code);
JLabel labelCountry = new JLabel("Country:");
labelCountry.setBounds(xdist, y+ydist*3, labelwidth, textheight);
panel.add(labelCountry);
JLabel labelTelephone = new JLabel("Phone:");
labelTelephone.setBounds(x, y+ydist*4, labelwidth, textheight);
panel.add(labelTelephone);
JLabel labelFax = new JLabel("Fax:");
labelFax.setBounds(xdist, y+ydist*4, labelwidth, textheight);
panel.add(labelFax);
JLabel labelContact_name = new JLabel("Contact Name:");
labelContact_name.setBounds(x, y+ydist*5, labelwidth, textheight);
panel.add(labelContact_name);
JLabel labelEmail = new JLabel("E-mail address:");
labelEmail.setBounds(xdist, y+ydist*5, labelwidth, textheight);
panel.add(labelEmail);
JLabel labelFind = new JLabel("Customer Number Search:");
labelFind.setBounds( 40, 360, 200, textheight);
panel.add(labelFind);
textAddress1 = new JTextField();
textAddress1.setBounds(x+labelwidth, y+ydist, textwidth, textheight);
panel.add(textAddress1);
textAddress2 = new JTextField();
textAddress2.setBounds(xdist+labelwidth, y+ydist, textwidth, textheight);
panel.add(textAddress2);
textTown = new JTextField();
textTown.setBounds(x+labelwidth, y+ydist*2, textwidth, textheight);
panel.add(textTown);
textCounty = new JTextField();
textCounty.setBounds(xdist+labelwidth, y+ydist*2, textwidth, textheight);
panel.add(textCounty);
textPost_code = new JTextField();
textPost_code.setBounds(x+labelwidth, y+ydist*3, textwidth, textheight);
panel.add(textPost_code);
textCountry = new JTextField();
textCountry.setBounds(xdist+labelwidth, y+ydist*3, textwidth, textheight);
panel.add(textCountry);
textTelephone = new JTextField();
textTelephone.setBounds(x+labelwidth, y+ydist*4, textwidth, textheight);
panel.add(textTelephone);
textFax = new JTextField();
textFax.setBounds(xdist+labelwidth, y+ydist*4, textwidth, textheight);
panel.add(textFax);
textContact_name = new JTextField();
textContact_name.setBounds(x+labelwidth, y+ydist*5, textwidth, textheight);
panel.add(textContact_name);
textEmail = new JTextField();
textEmail.setBounds(xdist+labelwidth, y+ydist*5, textwidth+50, textheight);
panel.add(textEmail);
textFind = new JTextField();
textFind.setBounds(200, 360, 80, textheight);
panel.add(textFind);
textCustomer_id = new JTextField();
textCustomer_id.setBounds(x+labelwidth, y, textwidth, textheight);
panel.add(textCustomer_id);
textCustomer_name = new JTextField();
textCustomer_name.setBounds(xdist+labelwidth, y, textwidth+50, textheight);
panel.add(textCustomer_name);
public boolean delete() {
textCustomer_id.setText("");
textCustomer_name.setText("");
textAddress1.setText("");
textAddress2.setText("");
textTown.setText("");
textCounty.setText("");
textPost_code.setText("");
textCountry.setText("");
textTelephone.setText("");
textFax.setText("");
textContact_name.setText("");
textEmail.setText("");
textFind.setText("");
return true;
public void displayButtons(){
firstCust= new JButton("FIRST");
firstCust.addActionListener(this);
firstCust.setBounds(50, 430, 100, 20 );
panel.add( firstCust );
nextCust = new JButton("NEXT");
nextCust.addActionListener(this);
nextCust.setBounds(150, 430, 100, 20 );
panel.add( nextCust );
prevCust = new JButton("PREVIOUS");
prevCust.addActionListener(this);
prevCust.setBounds(250, 430, 100, 20 );
panel.add( prevCust );
lastCust= new JButton("LAST");
lastCust.addActionListener(this);
lastCust.setBounds(350, 430, 100, 20 );
panel.add( lastCust );
findCust= new JButton("FIND");
findCust.addActionListener(this);
findCust.setBounds(350, 360, 100, 20 );
panel.add( findCust );
add = new JButton("ADD");
add.addActionListener(this);
add.setBounds(150, 400, 100, 20 );
panel.add( add );
save = new JButton("SAVE");
save.addActionListener(this);
save.setBounds(250, 400, 100, 20 );
panel.add( save );
jobs = new JButton("JOBS");
jobs.addActionListener(this);
jobs.setBounds(550, 360, 100, 20 );
panel.add( jobs );
close = new JButton("CLOSE");
close.addActionListener(this);
close.setBounds(550, 430, 100, 20 );
panel.add( close );
delete = new JButton("DELETE");
delete.addActionListener(this);
delete.setBounds(350, 400, 100, 20 );
panel.add( delete );
deleteCust = new JButton("DELETECUST");
deleteCust.addActionListener(this);
deleteCust.setBounds(450, 400, 100, 20);
panel.add( deleteCust );
public void getTextFields(){
currentCustomer.setCustomer_id(Integer.parseInt(textCustomer_id.getText()));
currentCustomer.setCustomer_name(textCustomer_name.getText());
currentCustomer.setAddress1(textAddress1.getText());
currentCustomer.setAddress2(textAddress2.getText());
currentCustomer.setTown(textTown.getText());
currentCustomer.setCounty(textCounty.getText());
currentCustomer.setPost_code(textPost_code.getText());
currentCustomer.setCountry(textCountry.getText());
currentCustomer.setFax(textFax.getText());
currentCustomer.setTelephone(textTelephone.getText());
currentCustomer.setContact_name(textContact_name.getText());
currentCustomer.setEmail(textEmail.getText());
public void setTextFields() throws SQLException{
textCustomer_id.setText(String.valueOf(currentCustomer.getCustomer_id()));
textCustomer_id.setEditable(false);
textCustomer_name.setText(currentCustomer.getCustomer_name());
textAddress1.setText(currentCustomer.getAddress1());
textAddress2.setText(currentCustomer.getAddress2());
textTown.setText(currentCustomer.getTown());
textCounty.setText(currentCustomer.getCounty());
textPost_code.setText(currentCustomer.getPost_code());
textCountry.setText(currentCustomer.getCountry());
textFax.setText(currentCustomer.getFax());
textTelephone.setText(currentCustomer.getTelephone());
textContact_name.setText(currentCustomer.getContact_name());
textEmail.setText(currentCustomer.getEmail());
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
try {
if (source == nextCust)
currentCustomer = inCustomerList.getNextCustomer();
else if (source == prevCust)
currentCustomer = inCustomerList.getPreviousCustomer();
else if (source == findCust) {
try {
currentCustomer =
inCustomerList.findCustomer(Integer.parseInt(textFind.getText()));
catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(
null, "Invalid Customer number", "ERROR",
JOptionPane.ERROR_MESSAGE);
if (currentCustomer == null) {
JOptionPane.showMessageDialog(null, "Customer not found");
currentCustomer = inCustomerList.getFirstCustomer();
textFind.setText(null);
else if (source == firstCust)
currentCustomer = inCustomerList.getFirstCustomer();
else if (source == lastCust)
currentCustomer = inCustomerList.getLastCustomer();
else if (source == add) {
currentCustomer = inCustomerList.addCust();
add.setEnabled(false);
else if (source == delete) {
delete();
else if (source == save) {
add.setEnabled(true);
getTextFields();
currentCustomer = inCustomerList.saveCustomer(currentCustomer);
//else if (source == jobs) {
// JFrame newJobForm = new JobForm(currentCustomer.getJobList());
//else if (source == deleteCust) {
//........... //currentCustomer = inCustomerList.deleteCustomer(currentCustomer);
else if (source == close) {
dispose();
setTextFields();
nextCust.setEnabled(!inCustomerList.isLast());
prevCust.setEnabled(!inCustomerList.isFirst());
firstCust.setEnabled(!inCustomerList.isFirst());
lastCust.setEnabled(!inCustomerList.isLast());
catch (SQLException ex) {
System.out.println("Failed");
System.out.println(ex.getMessage());
ex.printStackTrace();
System.exit(-1);
PLEASE HELP ME!!!http://www.ss64.demon.co.uk/orasyntax/
-
How to disable PUT/DELETE method in SMC tomcat
Hi,
SMC provides tomcat as the web server to allow logon the SMC console through IE.
For security consideration, we have to disable the http "PUT" and "DELETE" method of tomcat. Its config file seems to be /opt/SUNWsymon/web/conf/catalina.policy, but I have no knowledge of this file.
Do anyone know how to disable PUT/DELETE method in tomcat? Or provide me a reference book for this issue?
Thanks a lot.For security consideration, we have to disable the
http "PUT" and "DELETE" method of tomcat. Its config
file seems to be
/opt/SUNWsymon/web/conf/catalina.policy, but I have
no knowledge of this file.I'm not sure how to disable that feature, but be aware if you disable the ability for Agents to send files to the SunMC web server you may break all Configuration Tasks. Agent config files are sent to the Server by HTTP to allow them to be stored as templates/snapshots.
I don't remember seeing instructions on how to make the changes you want: the quickest way to find out is probably to call SunMC support.
Regards,
[email protected] -
Hot code replace failed - Delete method not implemented
I debug my Java application with Eclipse (3.1). When I change my code during debugging, I get the following error message:
...MyApp at localhost:4540 (may be out of synch) was unable to replace the running code with the code in the workspace.
Reason:
Hot code replace failed - Delete method not implemented
What does that mean and how can I fix this?This means you changed a class while it was debugging an application and it could not update the class for the application while it was running.
The error suggests you may be running an older JVM, i.e. pre-1.4.2 but this error can occur with any JVM if the change is incompatible with the previous version of the class.
The hot replace often does not work for non trivial changes to code. -
[svn:bz-trunk] 7494: Add testcaseses for http put and delete methods.
Revision: 7494
Author: [email protected]
Date: 2009-06-02 13:13:33 -0700 (Tue, 02 Jun 2009)
Log Message:
Add testcaseses for http put and delete methods. Proxy should return endpoint's content instead of empty body
Added Paths:
blazeds/trunk/qa/apps/qa-regress/remote/testMethods.jsp
blazeds/trunk/qa/apps/qa-regress/testsuites/mxunit/tests/proxyService/httpservice/bugs/Pu tAndDeleteMethodTests.mxmlfound it - here: http://discussions.apple.com/thread.jspa?threadID=2323131&tstart=30
I set the Realm to Location instead of Folder. Now I'm prompted for my credentials at the /svn/ URL. -
HttpService Put and Delete methods support
Hello,
HttpService doesn't seem to be supporting PUT and DELETE methods. The trick of using "X-HTTP-Method-Override" did send the request as PUT/DELETE request. But the server side code is unable to detect it as PUT/DELETE request. The server side code is in PHP and uses FuelPHP Framework.
Can anyone please suggest a way by which the request can be sent as PUT/DELETE such that it can be identified as same PUT/Delete request.
ThanksQ 1 and 2 : http://blogs.sun.com/meena/entry/disabling_trace_in_sun_java
About Q 3 ciphers which version of WebServer are you using? -
HTTP delete method handling / enabling??
Hi, I am a newbie to the WL world and wondering if there is any setup/config required on the weblogic server to enable the handling of HTTP DETELE method or does it all control/manage by the application? I understand web servers like Apache requires specific setup/scripts to handle the DELETE method. What about WebLogic Srvr?
To enable delete, there must be "modify"permission
given to the user account who has access to web
application. By default "IUSR_machinename" windows
account has anonymous access to web application in
IIS. You must have to give "modify" permission to
this acccount on the web application folder.
That's it !!!!! You are ready to send HTTP DELETE
requestsUmmmmmm. This seems a greatly dangerous and stupid
solution!I mean this topic is completely out of scope for this forum and I know not a whole lot about IIS but it seems to me you just set it up so anyone can delete files from your website.
Did you really want to do that? -
How to send message using Head,PUT,DELETE method
we can use Get,Post method in a form, but how to use Head,Put,DELETE method to submit. I try to use "method=head" in form tag, and write some code in doHead() method in servlet, but after I submit the form, the doHead() is not called by the servlet.
In HTML there is no Tag that support HEAD or PUT. You might create your own HTTP Client and implement HEAD and PUT Requests. Have a look at the HTTP Protocol to learn what they are used for and how they are to be implemented.
-
Hi,
Does Java have a delete method similar to something like StrDelete(startindex, endindex)?? I want to open a file, find a word in a line and then delete the next five lines.
Many thanks.I want to delete from the middle of a file (I have read the file into a temporary file, searched for a particular word and want to delete the next five lines). Alternatively I would like to say delete everything between "whatever" and "whatever2".
If a delete method only exists for a string then maybe I could read the file into a string though.
Any thoughts?
Thanks,
Aisling. -
Ask about DELETE method of HTTPService
Dear all,
I am developing an application to connect to a Photo Web
Storage on the internet.
and I have delete function to delete a photo.
but when I use a HTTPService (using method DELETE) to send a
delete request,
it always return an object (that is the photo I want to
delete).
I think that the HTTPService automatically ridirect the
DELETE function to GET function.
so the request brings up the photo
I have a check the Java Client Library, and i realize that
this library has set the strictPostRedirect
to true to prevent the convert from DELETE to GET
So my question is: AS3 have a similar properties as
strictPostRedirect?
Thank you for help
DatTVHi all,
I just find out the reason:
Flash Player does not support HTTP PUT and HTTP DELETE method
you can refer to the following for more:
http://www.nabble.com/httpservice-method-3D-22DELETE-22-does-not-work-to7165236.html -
Recover deleted method from class.
Hi,
Is there any way I can recover a method which I deleted from my active class. I haven't activated the new class yet.
Regards,
Swadhineven if you have saved the deleted Method just go to se10 see the Change request in which you have saved from there open the request you can see you class and in the Method which you deleted Double Click on it and see the method.
otherwise go for the Version Management of that Class not for the Method.
Because Your class is like your Function Group so with that the version managemnet of the Class you can get it back ....
Reward points if it is usefull...
Girish -
As per MSDN, we cannot use AppointmentItem.Delete() inside Close() event handler method of AppointmentItem. I need to find a way to delete this AppointmentItem (or preventing it from getting saved to Outlook calender). Please let me know if you have a way
to do this.
Thanks in advance.
PrasadHello Prasad,
You can run a timer or use any other suitable event handler. In the timer' tick event handler you can get an instance of the AppointmentItem class by using the GetItemFromId method of the Namespace class. You just need to pass an entryId value which you
may grab in the Close event handler.
Be aware, you need to use the Timer class which uses the single thread for their events. You should access Outlook objects on the main thread only. -
What is wrong with my delete method in my binary tree
code..okay so somehow everytime I delete a number that exist it says it has been deleted later when..I display the tree the node wasn' t really deleted at all here is the code..
public boolean delete(int numbers)
Node now = rootOrigin;
Node ancestor = rootOrigin;
boolean isLeftChild = true;
if(find(numbers)!= null)
if((now.LeftChildOfMine == null)&&(now.RightChildOfMine == null))
if(now == rootOrigin)
rootOrigin = null;
else if(isLeftChild)
ancestor.LeftChildOfMine = null;
else
ancestor.RightChildOfMine = null;
else if((now.LeftChildOfMine != null)&&(now.RightChildOfMine == null))
if(now==rootOrigin)
now = now.LeftChildOfMine;
else if(isLeftChild)
ancestor.LeftChildOfMine = now.LeftChildOfMine;
else
ancestor.RightChildOfMine = now.LeftChildOfMine;
else if((now.LeftChildOfMine == null)&&(now.RightChildOfMine != null))
if(now==rootOrigin)
rootOrigin = now.RightChildOfMine;
else if(isLeftChild)
//ancestor.LeftChildOfMine = now.RightChildOfMine;
ancestor.RightChildOfMine = now.LeftChildOfMine;
else
//ancestor.RightChildOfMine = now.RightChildOfMine;
ancestor.LeftChildOfMine = now.RightChildOfMine;
else if((now.LeftChildOfMine != null)&&(now.RightChildOfMine != null))
//get successor of node to delete(current)
Node successor = getSuccessor(now);
//connect parent of current to successor instead
if (now == rootOrigin)
rootOrigin = successor;
else if(isLeftChild)
ancestor.LeftChildOfMine = successor;
else
ancestor.RightChildOfMine = successor; //connect successor to current's left child
successor.LeftChildOfMine = now.LeftChildOfMine;
return true;
else
return false;
}Also here is the method that finds the successor of the node that will replace the node that i want to delete
private Node getSuccessor(Node delNode)
Node successorParent = delNode;
Node successor = delNode ;
Node now = delNode.RightChildOfMine;
while(now != null)
successorParent = successor;
successor = now;
now = now.LeftChildOfMine;
if(successor != delNode.RightChildOfMine)
successorParent.LeftChildOfMine = successor.RightChildOfMine;
successor.RightChildOfMine = delNode.RightChildOfMine;
return successor;
}Okay also a while ago when I focused on traversing(nodes kept displaying more than once) my prof. said the problem was in my insertion method.
It mayber the insertion method's fault again
public void insert(int numbers)
Node newNode = new Node(numbers);
if(rootOrigin == null)
rootOrigin = newNode; // newNode will be the root of the tree
else
Node current = rootOrigin;
Node parent;
while(true)
parent = current;
if(numbers < current.numbers)
current = current.LeftChildOfMine;
if(current == null)
parent.LeftChildOfMine = newNode;
return;
else
current = current.RightChildOfMine;
if(current == null)
parent.RightChildOfMine = newNode;
return;
}DaDonYordel wrote:
if(find(numbers)!= null)
if((now.LeftChildOfMine == null)&&(now.RightChildOfMine == null))Shouldn't you be assigning the result of the find() to now? -
DELETE() method..need help!!
private void deleteAll(){
File file;
String from = "C:/A/";
try {
file = new File(from);
} catch (Exception e) {
file = null;
e.printStackTrace();
if (file != null) {
String files[] = file.list();
for(int x = 0; x < files.length ; x ++){
File f = new File (files[x]);
if(f.isFile()){
f.delete();
}else{
System.out.print("WHAT PROBLEM?");
} else {
System.out.println("no such url");
} I wish to delete all files in C:/A/ when running this method..So anyone can find out what problems with my code..Thanks
Edited by: kahleong888 on Jun 14, 2008 9:06 PMKah,
To "prune" a whole directory and it's contents you need to depth-first-recurse the tree, (logically) pruning the branch you are standing on the way back up the tree... and if you (logically) recurse a "directory tree" from the "root" at the top... down to the "leaves" at the bottom, then shouldn't "trees" be called "roots" instead of "trees"... Hmmm... Just one of those things.
It goes something like this:
package forums;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
class Pruner
public static void main(String[] args) {
String top = args.length>0 ? args[0] : "C:/tmp/test/directoryToPrune";
try {
long start = System.currentTimeMillis();
int n = prune(top);
long took = System.currentTimeMillis()-start;
System.out.println("Removed "+n+" objects from "+top+" in "+took+" milliseconds.");
} catch (Exception e) {
e.printStackTrace();
private static int prune(String dirName)
throws FileNotFoundException, IOException
File dir = new File(dirName);
if ( !dir.exists() ) {
throw new FileNotFoundException("Not found: "+dir.getCanonicalPath());
return recursivePrune(dir);
private static int recursivePrune(File dir)
throws FileNotFoundException, IOException
String fullname = dir.getCanonicalPath();
int count = 0;
if ( dir.isDirectory() ) {
for (File file : dir.listFiles()) {
count += recursivePrune(file);
// having removed dir's contents we continue and remove dir.
// if dir isn't a dir then it must be a SINGLE file, soft-link, named-pipe...
if (!dir.delete()) {
throw new IOException("Failed to delete file: "+fullname);
return count+1;
}I recommend you move the prune(String dirName) method (and it's recursivePrune(...) helper method) to an abstract utilz class (something like $yourInitials.utilz.io.Dirz), and make it public of course.
Cheers. Keith. -
I am trying to remove photos from itunes so I can resync my ip4 and remove all the photos that were transferred from my Win7 PC when I synced the phone. No tabs on the phone to delete so I assume I will need to delete from itunes and resync the phone.
Any help would be greatly appreciated.
JMI believe you just are able to delete them from iTunes.
Hope it will be helpful -
FileInfo.Delete method appears to run in background
My app is set up to delete output file before regenerating them. It appears that the delete operation is running on a basckground thread. I am not certain what is happening but here is what I do know.
If the process to create the data to be written out runs quicker than normal, the file creation timestamp remains unchanged.
If I add a 1 second delay after deleting the file, the file creation timstamp is always the current time.
My users rely on the file creation timestamp to locate the latest changes.
Any ideas on how to change this behavior without adding a call to sleep()?
MacI think it's not about background thread. Instead you're bitten unexpectedly by
file system tunneling.
Try to get the system administrator
disable it for you and see if the symptom disappears. (Mind you, a few common programming techniques rely on this behavior so disabling it could break things. Always set up a test server to simulate normal operations for some time before deploy the change
to production. If you confirmed this is indeed the source of issue but cannot verify the possible impact, you're advised to seek for other techniques like saving the timestamp on database/NOSQL.)
Maybe you are looking for
-
hi just got a nokia c7 , im having troublr getting a gps fix when going on my location. a few times its work but im really confused on what i do when it comes up asking for me to define a network connection? do i click yes or no ,if i click yes it ha
-
How can I import my iTunes library from my iPod classic to my new computer?
I have just purchased a Macbook Air and would like to transfer the iTunes music files from my iPod classic into iTunes on the new computer. I can't access my old windows computer.
-
After installing iOS 7, iBooks doesn't work well. I have to log into my iTunes account before I can read the book that I've already downloaded and started reading. I also have problems logging in to iTunes and often have to do a complete shutdown and
-
Oracle Unicode Migration Scan Issue
When converting a database to unicode, how do I get past the scanning errors caused by a table without rows, such as some of those in the Apex schemas? I get the red circle in a white x message, for any tables that have no rows (such as the Bonus tab
-
Function module in Infotyp which checks if identical data already exists
I want to create a new hr master data (tcode pa30) for Hans Müller in e.g Company X and fill out the necessary fields in Infotype 0001,0002 (Name, Birthdate, etc. ) u2013 done ! After creating the new hr master data for Hans Müller Iu2019d like to f