delete

Deleting items in foreach

Should you be allowed to delete an item from the collection you are currently iterating in a foreach loop? If so, what should be the correct behavior? ...

Is this deallocation correct? (c++)

Hello, I've a 3x3 2D dynamic array allocated as below int** matrix = new int* [3]; matrix[0] = new int [3*3]; for (int i = 1; i < 3; ++i) matrix[i] = matrix[i-1] + 3; How should I deallocate it? Is it correct: delete [] matrix; delete [] matrix[0]; Or should I also delete matrix[1], [2] Greetings, ...

Protect against accidental deletion

Today I first saw the potential of a partial accidental deletion of a colleague's home directory (2 hours lost in a critical phase of a project). I was enough worried about it to start thinking of the problem ad a possible solution. In his case a file named '~' somehow went into a test folder, which he after deleted with rm -rf... when ...

NHibernate: Delete a child record from the parent collection

Hi, I'm developing a sample application so that I can learn the ins and outs of NHibernate. I am struggling with a delete issue. I wish to be able to delete a child record by removing it from its parent’s collection and then saving the parent. I have setup a bidirectional one-to-many relationship and inserting/updating is working great....

Image not deleted even after file.delete() method!!!

Hi All : I have to send mail along with embedded image. Once the mail has been sent, image in the application server should be deleted immediately. Problem i am facing is, after mail sent the control goes method which contain File file = new File("../bar.jpeg") if(file.exists()){ file.delete(); System.out.println(...

I can't delete a file in java

I'm trying to delete a file, after writing something in it, with FileOutputStream. This is the code I use for writing: private void writeContent(File file, String fileContent) { FileOutputStream to; try { to = new FileOutputStream(file); to.write(fileContent.getBytes()); to.flush(); to.close(); ...

Are Update/Delete/Insert on the Linq Roadmap?

Like SQL, Linq is a great way to retrieve data from various sources, but to date I haven't heard anyone talking about the other elements that SQL provides, specifically update/insert/delete. The various DLinq providers all offer their own mechanisms, but it seems like at some point modification of a data source would become part of the l...

How do I get a Rails link_to_remote tag to make a DELETE request when JavaScript is disabled?

I'm using the following code as a link to delete a todo in a simple todo list application I'm making: <%= link_to_remote 'delete', {:url => complete_todo, :confirm => 'Are you sure?', :method => :delete}, { :href => url_for(complete_todo), :method => :delete } %> It works fine when JavaScript is enabled, but when it's disabled it make...

Best practice for dealing with deleted table rows?

Here is my situation. I have the following tables: Product Product Attribute Order Product (references a product_id and an order_id) Order Product Attribute (references an order_product and a product_attribute) When an admin goes in to edit a product attribute (for instance "color"), he may delete that attribute by mistake and later ...

Hibernate Unidirectional Parent/Child relationship - delete() performs update on child table instead of delete

If I delete a record from the Parent table I want the corresponding records in the child table to be deleted. How can I make Hibernate delete from the Child table rather than attempt to update with a null? I'm using Hibernate 3 but cannot use annotations at this time. I've attached copies of HBM, DAO etc below. -- Thank you in Advance...

NHibernate - Many-to-Many Cascading Delete

Hi! I have defined a many to many relationship between two classes. Event and Person (defined in a separate database table person_event). Now, suppose I want to delete a person, so all its related associations with events must also get deleted from the person_event table. In other words, I want cascade ON DELETE. Lets consider a sce...

parentNode.parentNode.rowindex to delete a row in a dynamic table

Hello, I am creating my rows dynamically when the user clicks on "Ajouter". <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <scri...

Delete rows with matching multiple columns same table.

Using SQL, I have 5 columns: ssn, lastname, firstname, RF and a flag field. I need to go through this table and where the 4 columns are equal to another row and the value of the flag field in that row is equal to 2050, then delete that 2050 record. ...

Deleting duplicate rows from a table

I have a table in my database which has duplicate records that I want to delete. I don't want to create a new table with distinct entries for this. What I want is to delete duplicate entries from the existing table without the creation of any new table. Is there any way to do this? id action L1_name L1_data L2_name...

c# deleting files fails as held by and existing process

Hi, I'm having issues with a bit of code that I am writing in c#. I am sending a document using the MailMessage and SMTP components. I copy the files that I wish to send to a temp directory such as c:\temp, loop through the documents and attach them to the email. The email sends fine, however when I try to delete the files from the...

How to send PUT, DELETE HTTP request in HttpURLConnection ? Looks like not working.

I want to know if it is possible to send PUT, DELETE request (practically) through java.net.HttpURLConnection to HTTP-based URL. I have read so many articles describing that how to send GET, POST, TRACE, OPTIONS request but still not finding any sample code which successfully perform PUT and DELETE request. Can any one give idea regardin...

C++ dynamic memory detail

Hi folks, I'm a c and java programmer, so memory allocation and OOP aren't anything new to me. But, I'm not sure about how exactly to avoid memory leaks with C++ implementation of objects. Namely: string s1("0123456789"); string s2 = s1.substr(0,3); s2 now has a new string object, so it must be freed via: delete &s2; Right? Moreo...

SQL Delete if the row is not affected by constraints

First note that I have seen this question:TSQL delete with an inner join I have a large table and several foreign key relations, each of which have data of a given age. We need to remove data older than a given data on a regular basis to stop the DB from growing without bound. I'm writing a query that will delete from each point on th...

Is there a way to delete an output file in a post-build event.

I'm trying to run a post-build batch file on a .NET build that encrypts an output file, deletes the original and then renames the encrypted version to the original output filename. i.e.: Build A, then in post-build: Encrypt A->B DEL /F A RENAME B A I can't seem to delete the original output file after encryption though as it seems lik...

NHIBERNATE: Map Many-To-Many association (With attached Schema Image & mapping Files ...)

Hi! Please, I'm trying to map many-to-many association in order to use cascading Delete. Model Description: A View contains a List of Group (using the DB Association Table Asso_Project_Manager_Group_View). And a Group contains a List of Project Manager (using the DB Association Table Asso_Project_Manager_Group). Find DB Schema Image H...