delete

Should objects delete themselves in C++?

I've spent the last 4 years in C# so I'm interested in current best practices and common design patterns in C++. Consider the following partial example: class World { public: void Add(Object *object); void Remove(Object *object); void Update(); } class Fire : Object { public: virtual void Update() { if(age ...

Batch deletion / purging of records via Java ORM

Right - I want to delete (e.g.) 1,000,000 records from a database. This takes a long time -> the transaction times out and fails. So - I delete them in batches say 25000 records per transaction. Using the limit clause on MySQL or ROWNUM on Oracle. Great this works. I want to do this in a database indepedent way. And from an existing Jav...

Removing duplicate rows from table in Oracle

Hi, I'm testing something in Oracle and populated a table with some sample data, but in the process I accidentally loaded duplicate records, so now I can't create a primary key using some of the columns. How can I delete all duplicate rows and leave only one of them? This is in Oracle Thanks ...

Which version of safe_delete is better?

#define SAFE_DELETE(a) if( (a) != NULL ) delete (a); (a) = NULL; OR template<typename T> void safe_delete(T*& a) { delete a; a = NULL; } or any other better way ...

Exception when ASP.NET attempts to delete network file.

Greetings - I've got an ASP.NET application that is trying to delete a file on a network share. The ASP.NET application's worker process is running under a domain account (confirmed this by looking in TaskManager and by using ShowContexts2.aspx¹). I've been assured by the network admins that the process account is a member of a group t...

Is it safe to `delete this`?

In my initial basic tests it is perfectly safe to do so. However, it has struck me that attempting to manipulate this later in a function that deletes this could be a runtime error. Is this true, and is it normally safe to delete this? or are there only certain cases wherein it is safe? ...

Xcode duplicate/delete line

Coming from Eclipse and having been used to duplicate lines all the time, it's pretty strange finding out that Xcode has none such function. Or does it? I know it's possible to change the system wide keybindings but that's not what I'm after. TIA ...

SQL Server 2005: Audit random record deletion.

This may seem like a dumb question, but I'm in a head-> wall situation right now. I work on a massive ERP application in which the SQL Server 2005 database is updated by multiple disparate applications. I'm trying to figure out where the deletes in a particular table are originating from. I tried using the Profiler but I'm not able to...

Can someone explain this example of deleting elements from a matrix in MATLAB?

The following example appears in the MATLAB tutorial: X = [16 2 13; 5 11 8; 9 7 12; 4 14 1] Using a single subscript deletes a single element, or sequence of elements, and reshapes the remaining elements into a row vector. So: X(2:2:10) = [] results in: X = [16 9 2 7 13 12 1] Mysteriously, the entire 2nd ro...

Delete in Stored procedure

My delete query does not work conditionaly, it deletes all the records from tne table PROCEDURE "SP_NEW" ( logon_id IN VARCHAR2, id IN VARCHAR2, key IN VARCHAR2, error_code OUT NUMBER, error_message OUT VARCHAR2) ... PROCEDURE delete_counts(str_logon_id IN VARCHAR2) IS BEGIN DELETE FROM TMS_ENTITY_COUNT WHER...

MSSQL record date/time auto delete

I want to delete records from a db table based on a time-stamp for each record. I would like to have it automatically delete records compared to a date/time interval without user intervention or admin intervention. What would be the best way to go about this, I could create a process that runs in the background that does checks but that ...

SQL Server: Table Variables with an Alias in a Delete From Statement

I want to delete rows from a SQL Server 2000/2005 table variable based on the presence of other rows in the same table (delete all 0 count rows if a non-0 count row exists with the same date). Here is a simplified example that should only delete the row added first: declare @O table ( Month datetime, ACount int NULL ) insert i...

Delete First Line

I need a cmd script that deletes the first line in my text file. the scenario is the following: I take a txt file from FTP everyday, the problem is that it comes with blank line at the top then the headers of the file.. Since I'm importing that file automatically into an access table, that blank line is causing me problems.. So I urgent...

How do I delete a directory with read-only files in C#?

I need to delete a directory that contains read-only files. Which approach is better: using DirectoryInfo.Delete(), or ManagementObject.InvokeMethod("Delete")? With DirectoryInfo.Delete, I have to manually turn off the read-only attribute for each file, but ManagementObject.InvokeMethod("Delete") doesn't appear to need to. Is there an...

Is there any reason to check for a NULL pointer before deleting ?

I see some legacy code checking for null before deleting the pointer. as like below if(NULL != pSomeObject)//any reason for checking for null { delete pSomeObject; pSomeObject = NULL;//any reason for assigning null } my compiler is vc6 pre-standard one though. ...

How to intentionally delete a boost::shared_ptr?

I have many boost::shared_ptr<MyClass> objects, and at some point I intentionally want to delete some of them to free some memory. (I know at that point that I will never need the pointed-to MyClass objects anymore.) How can I do that? I guess you can't just call delete() with the raw pointer that I get with get(). I've seen a functio...

Firefox 3: Cannot delete cookies that were set in JavaScript on the server

I am trying to write PHP code to delete all of the user cookies on my domain. Here is what I got: <?php $domain = 'www.example.com'; $deleteExpiration = time() - 60*60*24*365*10; // 10 years ago foreach (array_keys($_COOKIE) as $cookie) { setcookie($cookie, 0, $deleteExpiration, '/', $domain); } Running this code on http://www.ex...

Strategy for detecting an object in JTable row?

Here's the thing: a sortable JTable backed by JTableModel with an array of objects that populate rows (one object = one row). Need to delete rows. Without sorting, deleting an object is simple: get selected row index, delete array object under the same index. With sorting, though, row indexes mess up in a sense that they no longer match...

Ignore modified (but not committed) files in git?

Can i tell git to ignore files that are modified (deleted) but should not be committed? The situation is that i have a subdir in the repo which contains stuff I'm not interested in at all, so I deleted it to prevent it showing up in auto-completions and the like (in the IDE). But now, if I add that folder to .gitignore, simply nothing ...

Why is there a special new and delete for arrays?

What is wrong with using delete instead of delete[]? Is there something special happening under the covers for allocating and freeing arrays? Why would it be different from malloc and free? ...