delete

C++: Call destructor and then constructor (resetting an object)

Hi. I want to reset an object. Can I do it in following way? anObject->~AnObject(); anObject = new(anObject) AnObject(); // edit: this is not allowed: anObject->AnObject(); This code is obviously a subset of typical life cycle of an object allocated by in placement new: AnObject* anObject = malloc(sizeof(AnObject)); anObject = new (a...

forfiles older than not working.

Hello i use the following command to delete files older than X days [%numb% is de amount of days] forfiles -p "%temp%" -s -m *.* -d %numb% -c "cmd /c del @path" Still.. When i execute it it just promps me with all features of forfiles and how it should be used... Help? ...

Delete a row at a certain line number in Postgres

I am building an app in which I need to delete a table row at a certain line number. I don't want to use or rely on an id, because if I delete a row, the following rows won't "shift down" -- line 8 today could be line 7 tomorrow, but line 8 will still have an id of 8. How can I write a postgres SQL that essentially does this: DELETE F...

Why won't JPA delete owned entities when the owner entity loses the reference to them?

Hi! I've got a JPA entity "Request", that owns a List of Answers (also JPA entities). Here's how it's defined in Request.java: @OneToMany(cascade= CascadeType.ALL, mappedBy="request") private List<Answer> answerList; And in Answer.java: @JoinColumn(name = "request", referencedColumnName="id") @ManyToOne(optional = false) private Req...

No delete database table

I need to create an article system where no articles are ever deleted. Even more, they want all article edits, once the original is saved, to create new articles rather than overwrite the old ones. So, person A writes article 1 and saves it. Person B edits article 1. What is the best way to organize this database? My thoughts are: ...

How to delete faster?

I have a DB table which consists of 2.5 billion records. There are duplicates to the tune of 11 million. Which is the fastest way to delete these 11 million records? ...

Delete a symbolic link when the original folder is deleted

I was thinking of using inotifywait to watch the original folder where the original folders are in, then when ever it detects that a folder has been deleted, then delete the same symbolic link in the other folder. So my question is, is that the best way? Or are there better ways to delete a symbolic link when the original folder gets de...

Delete a Line from a file in C Language

Hey, I want to delete certain lines in a file and insert certain lines in the same file based on whether certain parts of the line match a specified string. Is there a way of doing this without using a temporary file to copy the contents to and so on? Thanks Gitmo ...

Any reason to overload global new and delete?

Unless you're programming parts of an OS or an embedded system are there any reasons to do so? I can imagine that for some particular classes that are created and destroyed frequently overloading memory management functions or introducing a pool of objects might lower the overhead, but doing these things globally?? Addition I've just fo...

How to delete multiple records in linq with multiple conditions?

How to delete multiple records in linq with multiple conditions? ...

How can I delete LRU folders until 5GB free space is available

Given a folder \localhost\c$\work\ I'd like to run a powershell script every 15 minutes that ensures 5gb of free space is available. If < 5gb is available, remove the least recently used folder within work until >5gb is available. Gravy for nice output that can be redirected to a log file. Thoughts? ...

Zend Framework Deleting through a data mapper module.

I am still having problems getting table relationships defined, and have just changed the relationship between users and comment classes as advised, but when I went to test I got a new error. C:\wamp\www\megashare\application\models\UsersMapper.php public function deleteUser($id, Default_Model_Users $users){ $usersTable = new Defa...

How to view the deleted object in active directory

Can you just tell me, how to view the deleted objects in active directory without administrator login. Otherwise please tell me which ACEs can I use to view those deleted objects. ...

Recording MySQL DELETE statements

We have a MySQL->Oracle ETL using Informatica that works great for all statements except DELETE. Unfortunately, the DELETE makes the record go away such that Informatica never sees it again to remove/expire it in Oracle. How have people gone about recording MySQL DELETE statements? The tables are InnoDB (ACID-compliant) with unique pr...

How to prevent inadvertently using delete and free interchangeably in c++

When, if ever, can delete and free be used interchangeably in C++? My concern is as follows: Say there is an incorrect mixup in the use of malloc/free and new/delete (not to mention new[]/delete[]). However delete and free doing the same thing fortuitously so this goes uncaught in testing. Later this may lead to a crash in production. ...

LINQ to SQL delete producing "Specified cast is not valid" error

I've got a painfully simple table that is giving me a "Specified cast is not valid" error when I try to delete one or more rows. The table has two columns, an "id" as the primary key (INT), and a "name" (VARCHAR(20)), which maps to a String in the LINQ to SQL dbml file. Both of these statements produce the error: dc.DeleteOnSubmit(dc.My...

Delete SQL looping

I want to keep only 1000 entries for each clientid. The code below does what I want but does not loop through the clientid, instead keeping 1000 total of any of the clients. Is there a way to do this in sql? I was told i need a cursor, but I am hoping not. SQL 2005 DECLARE @ids TABLE ( id int ) DECLARE @clients TABLE ( clientid varc...

Batch Delete Files From File On Cmd Line

I have a long list of file names in a txt file, which I generated using findstr /M "string here" *.* > c:\files.log The file is about 3mb. Now i want to delete all of those files. I tried del < c:\files.log but that doesn't work. What should I use? ...

How to delete last line of file in Ruby?

Hey guys, probably a simple question but my google-fu is failing me and does not seem to be posted on SO yet... I basically have a file I am accessing and before I append to it I want to delete the last line from the file. Is there any efficient way of doing this in Ruby? This is what I am using to access the file: file = File.new("im...

Batch Scripting, For using the results of a dir

Hi All, I'm trying to write a small batch script that will delete files old files from a directory. The first parameter is the directory for the script to look into, and the second is the number of files to preserve. rem @ECHO OFF rem %1 is the path in which to look for the files rem %2 is the number of recent files to preserve if [%...