delete

C++ Beginner Delete Question

Hi all, This is my first year learning C++ so bear with me. I am attempting to dynamically allocate memory to the heap and then delete the allocated memory. Below is the code that is giving me a hard time: // String.cpp #include "String.h" String::String() {} String::String(char* source) { this->Size = this->GetSize(source); this->...

C++ delete[] operator

Is this the right way to use delete[] operator? int* a=new int[size]; delete[] a; If yes, Who (compiler or GC or whoever) will determine the size of the newly created array? and where will it store the array size? Thanks ...

ASP.NET LINQ to Delete Rows

Dim db As New SQLDataContext Try Dim deleteBoatPics = (From boat In db.Photos Where boat.boatid = id) db.Photos.DeleteOnSubmit(deleteBoatPics) db.SubmitChanges() Catch ex As Exception End Try I'm getting an error that says: Unable to cast object of type 'System.Data.Linq.DataQuery`1[WhiteWaterPhoto...

override delete function in entity framework

How can i make my own delete method to prevent that the data really gets deleted? i want to set a datetime field when it gets deleted insted of a normal delete. i read about overriding the submitchanges function, but i don't get it to work thanks ...

How to remove an item from a structure array in C++?

I have the following array structure (linked list): struct str_pair { char ip [50] ; char uri [50] ; str_pair *next ; } ; str_pair *item; I know to create a new item, I need to use item = new str_pair; However, I need to be able to loop through the array and delete a particular item...

Problem using delete[] (Heap corruption) when implementing operator+= (C++)

I've been trying to figure this out for hours now, and I'm at my wit's end. I would surely appreciate it if someone could tell me when I'm doing wrong. I have written a simple class to emulate basic functionality of strings. The class's members include a character pointer data (which points to a dynamically created char array) and an ...

Conditionally Delete in Ant

I want to delete the directory if the property "delete-compiled-dir" is set to true. If the property is false then do not execute it. Right now I have <target name="deleted-after-compilation" depends="compile,jar"> <condition property="${delete-compiled-dir}" value="true"> <delete dir="${compilation-dir}" /> ...

How to delete a folder in which was started ap a script? (php)

so I have a delete.php in folder abc so i call localhost/abc/delete.php . I want to be able to delete abc folder and all its contents from server when I call localhost/abc/delete.php How to do such thing? ...

Deleting columns with rows values from data table

I want to delete specific column from my datable before bounding it to a grid view. I tried with finalTable.Columns.RemoveAt(0); finalTable.Columns.RemoveAt(1); but it does not delete rows values belonging to that column.. How can we delete column with row values?? EDIT: After bounding it to gridview rows are displayed in 3rd colu...

Test, if object was deleted

Look to the following code, please: class Node { private: double x, y; public: Node (double xx, double yy): x(xx), y(yy){} }; int main() { Node *n1 = new Node(1,1); Node *n2 = n1; delete n2; n2 = NULL; if (n1 != NULL) //Bad test { delete n1; //throw an exception } } There are two pointers n1, n2 pointe...

Removing an object in a child collection in MongoDB

I've got a collection of content. Said collection has a collection of responses as such Content : [{ 'id' : '1234', 'Responses' : [{ 'id' : '12345' } etc. Now, I want to remove response 12345, but I don't want to remove all of the responses. I can't seem to find the command to do so. I'm getting the impression that th...

How to delete drupal's unused core modules correctly?

Hi I want to delete the unused drupal modules like ( blog, Forum, taxonomy ...) but I'm worried if I delete the modules from the modules directory I might cause an error (now or in the future) . is it safe? and if I deleted the corresponding tables what will happen? the reason for this is because I want to deliver the site to my clien...

Deleting a user > need to also delete their project, and then activities for that project? (PHP, MySQL)

Hi guys, Really stuck with this... basically my system has 4 tables; users, projects, user_projects and activities. The user table has a usertype field which defines whether or not they are admin or user (by an integer)... An admin can create a project, create an acitivity for the project and assign a user (limited access user) an acti...

Deleting rows with MySQL LEFT JOIN

Hello! I have two tables, one for job deadlines, one for describe a job. Each job can take a status and some statuses means the jobs' deadlines must be deleted from the other table. I can easily SELECT the jobs/deadlines that meets my criteria with a LEFT JOIN: SELECT * FROM `deadline` LEFT JOIN `job` ON deadline.job_id = job.job_id W...

Object Deletion: use parent or not

Which one do you prefer to delete objects? Especially in QT, but other practices are also welcome. These two alternatives seem same to me, are they? 1.Bound to another class, and destroy when it is destroyed. SomeClass::SomeClass{ socket_ = new QTcpSocket(this); } or 2.Destroy in the destructor of class SomeClass::SomeClass{ soc...

mysql delete and foreign key constraint

I'm deleting selected rows from both table in MYSQL, the two tables have foreign keys. delete d,b from A as b inner join B as d on b.bid=d.bid where b.name like '%xxxx%'; MYSQL complains about foreign keys even though I'm trying to delete from both tables: Error: Cannot delete or update a parent row: a foreign key constraint fails (yy...

NSFileManager delete contents of directory

How do you delete all the contents of a directory without deleting the directory itself? I want to basically empty a folder yet leave it (and the permissions) intact. ...

How to programmatically delete mail from Google Apps Mail using Google API ver 2 for .NET

I have created a dummy mail to create Empty Label in Google APPs mail. Now i want to remove this dummy mail after label is created? How can i do that? ...

Deleting a possibly locked file in c

I am using fcntl locks in C on linux and have a dilemma of trying to delete a file that may possibly be locked from other processes that also check for the fcntl locking mechanism. What would be the preferred way of handling this file which must be deleted, (Should I simply delete the file w/o regard of other processes that may have read...

can i know how to fix this error? is delete method

import javax.swing.*; import java.io.File; public class Third { public static void main(String[] args) throws Exception { String humanName; humanName = JOptionPane.showInputDialog(null, "Enter the file name"); File file = new File(+ humanName".txt"); System.out.println(file.delete()); JOpt...