f



delete on delete !

Hi,

If I do another delete on an object which has been deleted earlier, then
how is
the system expected to behave ?

Is it an unpredictable behavior ??

Thanks
Sandeep

0
7/11/2003 11:02:36 PM
comp.lang.c++ 49423 articles. 5 followers. Post Follow

19 Replies
1080 Views

Similar Articles

[PageSpeed] 57

Sandeep Grover wrote:
> Hi,
> 
> If I do another delete on an object which has been deleted earlier, then
> how is
> the system expected to behave ?
> 
> Is it an unpredictable behavior ??
> 

Yes, unpredictable.

Some will choke, some destructors SEGV, it goes on and on.

0
gi2nospam (1236)
7/11/2003 11:29:22 PM
Sandeep Grover wrote:

> If I do another delete on an object which has been deleted earlier, then
> how is the system expected to behave?
> 
> Is it an unpredictable behavior ??

It's undefined, so in theory, yes; anything could happen.

S

0
socode (15)
7/11/2003 11:32:06 PM

> Sandeep Grover wrote:
>
> > If I do another delete on an object which has been deleted earlier, then
> > how is the system expected to behave?
> >
> > Is it an unpredictable behavior ??
>
> It's undefined, so in theory, yes; anything could happen.
>
> S

Thanks !

So, if I have an array of pointers; more than one of the entries could point
to
the same chunk of memory (allocated using new). How do I ensure that I
end up deleting that entry only once. I dont want to use reference-counting
kind of thing in constructor.



0
7/11/2003 11:53:31 PM
On Fri, 11 Jul 2003 16:53:31 -0700, Sandeep Grover <sandeep@magma-da.com> wrote:

>[I]f I have an array of pointers; more than one of the entries could
>point to the same chunk of memory (allocated using new). How do I ensure
>that I end up deleting that entry only once. I dont want to use
>reference-counting kind of thing in constructor.

The sane thing to do would be to use reference-counting.

Reference-counting is automated by many smart-pointers; the most general
and compatible with upcoming standard is boost::shared_ptr (go to
<url:hhtp://www.boost.org> to download the Boost library, it's free).

Without reference-counting you can just sort the array first, on the
pointer values; even though pointers that do not point into the same
variable are not formally comparable, they are comparable in practice.
But you need to know that the array contains pointers to all objects
that you need to delete.  And in that case, why not store the unique
pointers in a separate array of the same size or less?

0
alfps (7389)
7/12/2003 12:02:57 AM
"Sandeep Grover" <sandeep@magma-da.com> wrote in message
news:3F0F4DFB.EC0629EF@magma-da.com...
>
>
> > Sandeep Grover wrote:
> >
> > > If I do another delete on an object which has been deleted earlier,
then
> > > how is the system expected to behave?
> > >
> > > Is it an unpredictable behavior ??
> >
> > It's undefined, so in theory, yes; anything could happen.
> >
> > S
>
> Thanks !
>
> So, if I have an array of pointers; more than one of the entries could
point
> to
> the same chunk of memory (allocated using new). How do I ensure that I
> end up deleting that entry only once. I dont want to use
reference-counting
> kind of thing in constructor.


Use a vector of the objects you want, or a list if it suits better the
problem, and not a built in array of pointers.







-- 
Ioannis

* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net

0
ivr1 (30)
7/12/2003 12:04:30 AM
"Alf P. Steinbach" wrote:
> 
> Without reference-counting you can just sort the array first, on the
> pointer values; even though pointers that do not point into the same
> variable are not formally comparable, they are comparable in practice.

If you use std::greater, std::less, std::greater_equal, or
std::less_equal they are comparable. It's just the builtin operators
that are allowed to be fast. <g>

--

"To delight in war is a merit in the soldier,
a dangerous quality in the captain, and a
positive crime in the statesman."
	George Santayana

"Bring them on."
	George W. Bush
0
petebecker (1324)
7/12/2003 12:07:49 AM
Sandeep Grover wrote:
> 
>>Sandeep Grover wrote:
>>
>>
>>>If I do another delete on an object which has been deleted earlier, then
>>>how is the system expected to behave?
>>>
>>>Is it an unpredictable behavior ??
>>
>>It's undefined, so in theory, yes; anything could happen.
>>
>>S
> 
> 
> Thanks !
> 
> So, if I have an array of pointers; more than one of the entries could point
> to the same chunk of memory (allocated using new). How do I ensure that I
> end up deleting that entry only once. I dont want to use reference-counting
> kind of thing in constructor.

A flippant answer would be not to alias pointers.

On the other hand, techniques such as reference-counting
are for when you need multiple pointers to the same object
which you wish to dispose of independently, but don't need
an invasive implementation, i.e. an implementation inside
the pointed-to object.

But this is really a design issue, not a language issue.

S

0
socode (15)
7/12/2003 12:09:20 AM
"Ioannis Vranos" <ivr@nothis.emails.ru> wrote in message
news:3f0f5032$0$240$4d4eb98e@read.news.gr.uu.net...
| "Sandeep Grover" <sandeep@magma-da.com> wrote in message
| news:3F0F420C.61E6C7E6@magma-da.com...
| > Hi,
| >
| > If I do another delete on an object which has been deleted earlier, then
| > how is
| > the system expected to behave ?
|
|
| It will get angry.

Depends.

| > Is it an unpredictable behavior ??

| Yes it is undefined behaviour. It may die, it may continue living and die
| later, it may truncate data, everything.

Again it depends.

If you set the pointer to zero straight after you have deleted
it, then the behaviour is very defined, and safe.

For example:

# include <iostream>
# include <ostream>

struct Base
 {
  int N;
 };

int main()
 {
  Base* B = new Base;

  delete B;
  B = 0; // Introduce a safety net.

  for( int Idx( 0 ); Idx < 5; ++Idx )
       delete B;  // Safe - no opp.

  return 0;
 }

Cheers.
Chris Val


0
chrisval (254)
7/12/2003 7:16:00 AM
"Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
news:beocjc$7bdj4$1@ID-110726.news.uni-berlin.de...
>
>
> | Yes it is undefined behaviour. It may die, it may continue living and
die
> | later, it may truncate data, everything.
>
> Again it depends.
>
> If you set the pointer to zero straight after you have deleted
> it, then the behaviour is very defined, and safe.


He/she said:

"If I do another delete on an object which has been deleted earlier, then
how is the system expected to behave ?".


That means that the pointer will not point to 0.




-- 
Ioannis

* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net


0
ivr1 (30)
7/12/2003 2:50:08 PM
"Ioannis Vranos" <ivr@nothis.emails.ru> wrote in message
news:3f10201e$0$233$4d4eb98e@read.news.gr.uu.net...
| "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
| news:beocjc$7bdj4$1@ID-110726.news.uni-berlin.de...
| >
| >
| > | Yes it is undefined behaviour. It may die, it may continue living and
| die
| > | later, it may truncate data, everything.
| >
| > Again it depends.
| >
| > If you set the pointer to zero straight after you have deleted
| > it, then the behaviour is very defined, and safe.
|
|
| He/she said:
|
| "If I do another delete on an object which has been deleted earlier, then
| how is the system expected to behave ?".

Yes, I know that.

| That means that the pointer will not point to 0.

That is why I said:

*If you set the pointer to zero *straight after* you have deleted it*

Meaning, the first time you delete it, set it to zero, making the
behaviour of deleting it again defined and safe.

Cheers.
Chris Val


0
chrisval (254)
7/12/2003 4:21:37 PM
On Sun, 13 Jul 2003 02:21:37 +1000, "Chris \( Val \)" <chrisval@bigpond.com.au> wrote:

>
>"Ioannis Vranos" <ivr@nothis.emails.ru> wrote in message
>news:3f10201e$0$233$4d4eb98e@read.news.gr.uu.net...
>| "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
>| news:beocjc$7bdj4$1@ID-110726.news.uni-berlin.de...
>| >
>| >
>| > | Yes it is undefined behaviour. It may die, it may continue living and
>| die
>| > | later, it may truncate data, everything.
>| >
>| > Again it depends.
>| >
>| > If you set the pointer to zero straight after you have deleted
>| > it, then the behaviour is very defined, and safe.
>|
>|
>| He/she said:
>|
>| "If I do another delete on an object which has been deleted earlier, then
>| how is the system expected to behave ?".
>
>Yes, I know that.
>
>| That means that the pointer will not point to 0.
>
>That is why I said:
>
>*If you set the pointer to zero *straight after* you have deleted it*
>
>Meaning, the first time you delete it, set it to zero, making the
>behaviour of deleting it again defined and safe.

It's possibly not meaningful to discuss the finer points of language
here, but at least regarding the last few postings there seems to be
confusion about the concept of deleting an object (which cannot be
done without a non-null pointer value) and "deleting a pointer",
probably meaning to use that pointer in a delete expression, which if
it has a technical meaning would be a totally _different_ meaning.

Since the original poster wrote about deleting objects, not pointers,
and furthermore about deleting the same object twice, the only
reasonable interpretation is that what was meant was first deleting
the object, and then performing a delete operation again on the now
invalid pointer value (which for this technically can't be zero).

Setting a pointer to zero after the object it denoted has been
deleted is not an evil practice, though, but don't rely on it to catch
all errors associated with deallocation  --  some argue that it might
give a false sense of security + complicates the code + may hide some
errors/bugs, and therefore should be _avoided_ one hundred percent.

0
alfps (7389)
7/12/2003 5:06:35 PM
"Alf P. Steinbach" <alfps@start.no> wrote in message
news:3f103e4c.132291921@News.CIS.DFN.DE...
| On Sun, 13 Jul 2003 02:21:37 +1000, "Chris \( Val \)" <chrisval@bigpond.com.au> wrote:
|
| >
| >"Ioannis Vranos" <ivr@nothis.emails.ru> wrote in message
| >news:3f10201e$0$233$4d4eb98e@read.news.gr.uu.net...
| >| "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
| >| news:beocjc$7bdj4$1@ID-110726.news.uni-berlin.de...
| >| >
| >| >
| >| > | Yes it is undefined behaviour. It may die, it may continue living and
| >| die
| >| > | later, it may truncate data, everything.
| >| >
| >| > Again it depends.
| >| >
| >| > If you set the pointer to zero straight after you have deleted
| >| > it, then the behaviour is very defined, and safe.
| >|
| >|
| >| He/she said:
| >|
| >| "If I do another delete on an object which has been deleted earlier, then
| >| how is the system expected to behave ?".
| >
| >Yes, I know that.
| >
| >| That means that the pointer will not point to 0.
| >
| >That is why I said:
| >
| >*If you set the pointer to zero *straight after* you have deleted it*
| >
| >Meaning, the first time you delete it, set it to zero, making the
| >behaviour of deleting it again defined and safe.
|
| It's possibly not meaningful to discuss the finer points of language
| here, but at least regarding the last few postings there seems to be
| confusion about the concept of deleting an object (which cannot be
| done without a non-null pointer value) and "deleting a pointer",
| probably meaning to use that pointer in a delete expression, which if
| it has a technical meaning would be a totally _different_ meaning.

Fair enough.

| Since the original poster wrote about deleting objects, not pointers,
| and furthermore about deleting the same object twice, the only
| reasonable interpretation is that what was meant was first deleting
| the object, and then performing a delete operation again on the now
| invalid pointer value (which for this technically can't be zero).

I understand the context in which the OP posted his/her question.

I only provided an suggestion. That is why I used words such as:
'depends', 'if' and 'after'.

| Setting a pointer to zero after the object it denoted has been
| deleted is not an evil practice, though, but don't rely on it to catch
| all errors associated with deallocation  --  some argue that it might
| give a false sense of security + complicates the code + may hide some
| errors/bugs, and therefore should be _avoided_ one hundred percent.

I've never heard anyone suggest that before.
Can you give me an example of where such circumstances can arise ?.

Cheers.
Chris Val


0
chrisval (254)
7/12/2003 5:29:50 PM
On Sun, 13 Jul 2003 03:29:50 +1000, "Chris \( Val \)" <chrisval@bigpond.com.au> wrote:

>"Alf P. Steinbach" <alfps@start.no> wrote in message
>news:3f103e4c.132291921@News.CIS.DFN.DE...
>| Setting a pointer to zero after the object it denoted has been
>| deleted is not an evil practice, though, but don't rely on it to catch
>| all errors associated with deallocation  --  some argue that it might
>| give a false sense of security + complicates the code + may hide some
>| errors/bugs, and therefore should be _avoided_ one hundred percent.
>
>I've never heard anyone suggest that before.
>Can you give me an example of where such circumstances can arise ?.

Not that this is my argument, I think the pros and cons nearly cancel
out, but here is one scenario.  A firm or shop or project standardizes
on setting pointers to zero after delete.  Such pointers can safely be
passed to functions that check for null, and so they're passed around.
In one function there is an incorrect delete via the passed pointer.
This isn't detected because the pointer is null.  Later that function
is used with a more valuable real pointer value.  It then incorrectly
deletes an object it shouldn't.  The effect only shows up much later
in the code execution, and it's then very hard to track down the cause.


0
alfps (7389)
7/12/2003 5:56:04 PM
"Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
news:bepgic$7fgni$1@ID-110726.news.uni-berlin.de...
>
>
> I've never heard anyone suggest that before.
> Can you give me an example of where such circumstances can arise ?.



There are many philosophical approaches. Many believe -including me- that
the second deletion of an object is the last thing of improper use one will
do on it, before he will have tried to read or write to it.

A better use is always use the standard library containers instead of
allocating and deallocating memory explicitly. So for example, instead of
using an array of pointers, use a vector of objects or whatever container of
the standard library fits your purpose better (e.g. a list).







-- 
Ioannis

* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net

0
ivr1 (30)
7/12/2003 7:45:16 PM
"Ioannis Vranos" <ivr@nothis.emails.ru> wrote in message
news:3f10654a$0$240$4d4eb98e@read.news.gr.uu.net...
| "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
| news:bepgic$7fgni$1@ID-110726.news.uni-berlin.de...
| >
| >
| > I've never heard anyone suggest that before.
| > Can you give me an example of where such circumstances can arise ?.
|
|
|
| There are many philosophical approaches. Many believe -including me- that
| the second deletion of an object is the last thing of improper use one will
| do on it, before he will have tried to read or write to it.

Point taken.

| A better use is always use the standard library containers instead of
| allocating and deallocating memory explicitly. So for example, instead of
| using an array of pointers, use a vector of objects or whatever container of
| the standard library fits your purpose better (e.g. a list).

Agreed.

Cheers.
Chris Val


0
chrisval (254)
7/13/2003 8:27:25 AM
"Sandeep Grover" <sandeep@magma-da.com> wrote in message
news:3F0F4DFB.EC0629EF@magma-da.com...
>
>
> > Sandeep Grover wrote:
> >
> > > If I do another delete on an object which has been deleted earlier,
then
> > > how is the system expected to behave?
> > >
> > > Is it an unpredictable behavior ??
> >
> > It's undefined, so in theory, yes; anything could happen.
> >
> > S
>
> Thanks !
>
> So, if I have an array of pointers; more than one of the entries could
point
> to
> the same chunk of memory (allocated using new). How do I ensure that I
> end up deleting that entry only once. I dont want to use
reference-counting
> kind of thing in constructor.
>

How can you point two pointers (allocated using new) to the same location???
If you are pointing a pointer to an already allocated piece of memory, you
CANT use the "reference-counting kind of thing in constructor".

The best solution, IMHO, would be to use smart pointers.


--
-Ashish
--------------------------------------------------------------------------
Hi! I'm a shareware signature! Send $5 if you use me, send $10 for manual!
http://www.123ashish.com    http://www.softwarefreaks.com

>
>


0
ashoooo (45)
7/14/2003 4:16:00 PM
"Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
news:bepcig$70vir$1@ID-110726.news.uni-berlin.de...
>
> "Ioannis Vranos" <ivr@nothis.emails.ru> wrote in message
> news:3f10201e$0$233$4d4eb98e@read.news.gr.uu.net...
> | "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
> | news:beocjc$7bdj4$1@ID-110726.news.uni-berlin.de...
> | >
> | >
> | > | Yes it is undefined behaviour. It may die, it may continue living
and
> | die
> | > | later, it may truncate data, everything.
> | >
> | > Again it depends.
> | >
> | > If you set the pointer to zero straight after you have deleted
> | > it, then the behaviour is very defined, and safe.
> |
> |
> | He/she said:
> |
> | "If I do another delete on an object which has been deleted earlier,
then
> | how is the system expected to behave ?".
>
> Yes, I know that.
>
> | That means that the pointer will not point to 0.
>
> That is why I said:
>
> *If you set the pointer to zero *straight after* you have deleted it*

I think you have misunderstood the problem.
The OP's problem is that more than one pointers point to the same location.

Lets assume that p1 and p2 point to location m1.
Delete m1 using p1.
Set p1 to NULL.
So far so good.
Now, delete p2, the behaviour is undefined. And you had no idea that p2 also
points to m1.


>
> Meaning, the first time you delete it, set it to zero, making the
> behaviour of deleting it again defined and safe.
>
> Cheers.
> Chris Val
>
>


--
-Ashish
--------------------------------------------------------------------------
Hi! I'm a shareware signature! Send $5 if you use me, send $10 for manual!
http://www.123ashish.com    http://www.softwarefreaks.com


0
ashoooo (45)
7/14/2003 4:20:45 PM

"Chris ( Val )" wrote:
> 
> | I think you have misunderstood the problem.
> | The OP's problem is that more than one pointers point to the same location.
> |
> | Lets assume that p1 and p2 point to location m1.
> | Delete m1 using p1.
> | Set p1 to NULL.
> | So far so good.
> | Now, delete p2, the behaviour is undefined. And you had no idea that p2 also
> | points to m1.
> 
> Yes, that is true.
> 
> However, its the programmers job and responsibility to keep
> track of such things, and take preventative measures to avoid
> this issue all together.
> 

Exactly.

But especially newbies tend to think: If I set the pointer to
0 immediatly after the delete, nothing bad can happen any more.
This (having a second pointer to the same object) is a counter-
example. That's why lots of programmers warn about setting
a pointer to 0: It creates a false sense of security.
Don't get me wrong: setting a pointer to 0 can't do any harm
and is often a good idea. But it doesn't solve all dynamic
memory related problems.

-- 
Karl Heinz Buchegger
kbuchegg@gascad.at
0
kbuchegg (2095)
7/15/2003 2:40:09 PM
"Karl Heinz Buchegger" <kbuchegg@gascad.at> wrote in message
news:3F141249.C40534F0@gascad.at...
|
|
| "Chris ( Val )" wrote:
| >
| > | I think you have misunderstood the problem.
| > | The OP's problem is that more than one pointers point to the same location.
| > |
| > | Lets assume that p1 and p2 point to location m1.
| > | Delete m1 using p1.
| > | Set p1 to NULL.
| > | So far so good.
| > | Now, delete p2, the behaviour is undefined. And you had no idea that p2 also
| > | points to m1.
| >
| > Yes, that is true.
| >
| > However, its the programmers job and responsibility to keep
| > track of such things, and take preventative measures to avoid
| > this issue all together.
| >
|
| Exactly.
|
| But especially newbies tend to think: If I set the pointer to
| 0 immediatly after the delete, nothing bad can happen any more.
| This (having a second pointer to the same object) is a counter-
| example. That's why lots of programmers warn about setting
| a pointer to 0: It creates a false sense of security.
| Don't get me wrong: setting a pointer to 0 can't do any harm
| and is often a good idea. But it doesn't solve all dynamic
| memory related problems.

Point taken :-).

Thanks Karl.
Chris Val


0
chrisval (254)
7/22/2003 10:09:23 AM
Reply:

Similar Artilces:

does deleting accounts delete files too?
Hi Althogh I have been a long time Mac user, I have never had to have more than just the one account for myself Helping a friend today, it seems she saved files while using account yyy, then somehow 'lost' this account and also her admin account xxx password We have been able to enable another admin account, so she now had admin privileges, but cannot locate the files that were produced while using account yyy, or the desk-top that she was using then I am not sure about whether if we delete all other accounts except the new admin account, files made while in other accounts and the desktop she used with them will also be deleted Help will be much appreciated David PS its OSX 10.4x running on a G5 David Ross <david@djross.com.au> wrote: > Althogh I have been a long time Mac user, I have never had to have more > than just the one account for myself > > Helping a friend today, it seems she saved files while using account > yyy, then somehow 'lost' this account and also her admin account xxx > password > > We have been able to enable another admin account, so she now had admin > privileges, but cannot locate the files that were produced while using > account yyy, or the desk-top that she was using then > > I am not sure about whether if we delete all other accounts except the > new admin account, files made while in other accounts and the desktop > she used with them will also be deleted > PS ...

DELETE only deleted 10000 records
I have a stored procedure: DELETE FROM dbo.Period_NonLabor WHERE (Period_Date = '6/13/2008') I have to run it multiple times because it only deletes 10000 records each time I run it. Is there a way to force it to delete all records? Thanks! Jer (jerry.w.black@saic.com) writes: > I have a stored procedure: > DELETE FROM dbo.Period_NonLabor > WHERE (Period_Date = '6/13/2008') > > I have to run it multiple times because it only deletes 10000 records > each time I run it. Is there a way to force it to delete all records? Sounds like you have run SET ROWCOUNT 10000 at some point. Run SET ROWCOUNT 0, and you should be fine. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx On Aug 25, 3:04=A0pm, Erland Sommarskog <esq...@sommarskog.se> wrote: > Jer (jerry.w.bl...@saic.com) writes: > > I have a stored procedure: > > DELETE FROM dbo.Period_NonLabor > > WHERE =A0 =A0 (Period_Date =3D '6/13/2008') > > > I have to run it multiple times because it only deletes 10000 records > > each time I run it. =A0Is there a way to force it to delete all records= ? > > Sounds like you have run SET ROWCOUNT 10000 at some point. Run > SET ROWCOU...

Trigger After Delete
hello, I googled around some time but I found no solution for this issue (SS2000). I have a table tblB which has to be filled whenever in another table tblA records are inserted, updated or deleted. So I created one trigger which works fine for inserts and updates and fills my tblB. tblB is filled with other fields which I get from a view vwC. The issue is about this view. When in tblA a record is deleted, the corresponding record in vwC does not exist and I can't fill tblB. I tried around with INSTEAD OF -Trigger and got error message because tblA has RI cascades so this is not possible. A temp table could be the right way? Can you show me an example? thanks -- candide_sh I believe you will have to do it without the view. You would need the view to join the DELETED table to those other tables, and no view can reference DELETED. In the trigger, in the FROM clause, replace the reference to the view with a derived table using the same SELECT as the view. So instead of: FROM ViewName you will need FROM (<SELECT.....>) as ViewName Note that if you have an alias assigned to the view reference that would go after the "as" rather than ViewName. Roy Harvey Beacon Falls, CT On Tue, 17 Jul 2007 08:04:59 -0700, candide_sh@yahoo.de wrote: >hello, >I googled around some time but I found no solution for this issue >(SS2000). > >I have a table tblB which has to be filled whenever in another table >tblA records are inserted, updated or...

Delete row from mysql only deletes the contents?
mysql_query("DELETE FROM cart WHERE ItemId=$ItemId"); There is the code but the result in my databse is that the ID number changes from, lets say, 77 to 78 with 78's contents being empty. Therefore when I look at the results - the deleted ID77 is gone but now I have ID78 with no content! Does anyone know why and how do I make it stop? MIchael de Beers wrote: > mysql_query("DELETE FROM cart WHERE ItemId=$ItemId"); > > There is the code but the result in my databse is that the ID number changes > from, lets say, 77 to 78 with 78's contents being empty. Therefore when I > look at the results - the deleted ID77 is gone but now I have ID78 with no > content! > > Does anyone know why and how do I make it stop? Your SQL query don't create a new empty row, you may have a bad if-statement that makes your INSERT query to be run while you are deleting. //Aho "de Beers" <fdgdf@yahoo.ca> wrote in message news:T4aWc.7150$_H5.94122@news20.bellglobal.com... > mysql_query("DELETE FROM cart WHERE ItemId=$ItemId"); Gah!!! Always use the mysql connection id, and ALWAYS test database (and all other IO) operations for errors! $result = mysql_query("DELETE FROM cart WHERE ItemId='$ItemId'" , $conn); if(! $result || mysql_error()) { echo "Something went wrong with deleting this record: " . mysql_error($conn); exit; } ALWAYS delimit items in a SQL system using &...

cannot delete
there are 2 query which will return 0 record when I just select it from table. but 2 queries are almost same structure but 1 return error and another 1 no error. anybody know why? DELETE FROM (SELECT FWDBOOK_HBL.COMPANYCODE,FWDBOOK_HBL.BRANCHCODE,FWDBOOK_HBL.JOBNO FROM FWDBOOK_HBL@ORACLE8,FWDBOOK_HD@ORACLE8 WHERE FWDBOOK_HD.COMPANYCODE = FWDBOOK_HBL.COMPANYCODE AND FWDBOOK_HD.BRANCHCODE=FWDBOOK_HBL.BRANCHCODE AND FWDBOOK_HD.JOBNO=FWDBOOK_HBL.JOBNO AND (FWDBOOK_HD.CANCEL='Y' OR FWDBOOK_HD.CLSDBO='Y') AND FWDBOOK_HD.BOOKINGDATE BETWEEN TO_DATE('12-12-2001','DD-MM-YYYY') AND TO_DATE('12-12-2006','DD-MM-YYYY')); ERROR at line 2: ORA-01752: cannot delete from view without exactly one key-preserved table DELETE FROM (SELECT FWDINVOICE_DET.COMPANYCODE,FWDINVOICE_DET.BRANCHCODE, FWDINVOICE_DET.JOBNO,FWDINVOICE_DET.INVOICENO FROM FWDINVOICE_DET@ORACLE8,FWDINVOICE_HD@ORACLE8 WHERE FWDINVOICE_HD.COMPANYCODE = FWDINVOICE_DET.COMPANYCODE AND FWDINVOICE_HD.BRANCHCODE=FWDINVOICE_DET.BRANCHCODE AND FWDINVOICE_HD.INVOICENO=FWDINVOICE_DET.INVOICENO AND ( FWDINVOICE_HD.CANCEL= 'Y' OR FWDINVOICE_HD.APPROVED='Y') AND FWDINVOICE_HD.INVOICEDATE BETWEEN TO_DATE('12-12-2001','DD-MM-YYYY') AND TO_DATE('12-12-2006','DD-MM-YYYY')); 0 rows deleted. It looks like fwdinvoice_det.invoiceno is primary key in fwdinvoice_det@oracle8 table, therefore the error raised by the first query. Cheers, Valentin skyl...

Re: to delete or not to delete outliers for extremly skewed
Could you tell us what the variables are and how they are currently = distributed? Yes, it would be possible to put them in categories, but = you do lose information by doing this. =20 We had a fairly raucous discussion of this last year when a user was = trying to deal with a family wealth variable to decide how that affected = sending children to college (and we have learned very well in the past = few weeks that wealth can be negative :-) ). =20 Here was Dale's thoughts on binning, but clearly the discussion before = it was that turning a continous variable into categories just because it = has extreme values should be done with caution, so it would help to know = what the variables are before someone can really advise you. The log = of the value, if it is only positive, may be another option. -Mary ----- Original Message -----=20 From: Dale McLerran=20 To: SAS-L@LISTSERV.UGA.EDU=20 Sent: Thursday, November 15, 2007 5:14 PM Subject: Re: Transforming negative variable Binning has the advantage that the bin means can represent a nonlinear functional form even though a linear model is fit (at least when the binned variable is treated as a categorical predictor variable). Within bin residuals may have large residuals for some observations, but the trade-off is that the expectation is modeled reasonably. In terms of mean-squared-error, the MSE may be small for a model with reasonably chosen bins because the expectation is appropriately modeled. When a parametri...

Delete
I am seeing "Delete" in fields on my form. What causes that? Thanks! Stacey What are the circumstances? It is common if your application is a client to a server DB and you have used the server equivalent of AutoNumber as the PK of server tables. As soon as the update occurs, Access "loses track of the record" and shows "#Deleted" -- but the data/record has been saved. Larry Linson Microsoft Access MVP "Stacey" <sallen@earthlink.net> wrote in message news:Je2Hb.10593$IM3.3194@newsread3.news.atl.earthlink.net... > I am seeing "Delete" in fields on my form. What causes that? > > Thanks! > > Stacey > > ...

#Deleted
Hi c-d-m, I have encountered, in a queried field on a form, "#Deleted" when another user is in the DB and I enter the DB to poke around. The problem disappears when the user exits and re-enters the form, and no data is lost. I cannot find anything in the help files related to this result. Any hints on preventing it? TIA, Greg *Remove SPLAT to responond directly * ...

deleting this
I was just toying around idea of deleting this from a member function. Was expecting that any acess to member variable or function after deleting sould give me dump(segmetation violation).Cause now I am trying to access freed. memory. Is my assumption correct? I tried following code --------------------------------------------------- #include <iostream.h> class A { public: A():_i(0){} A(int i_):_i(i_){} void killself(){cout<<"deleting this"<<endl;delete this;A* test = ((A*)t his);test=0;_i = 5;} int getI(){return _i;} void setI(int i_=0){_i= i_;} private: int _i; }; int main() { A a; a.setI(10); cout<<a.getI()<<endl; a.killself(); cout<<a.getI()<<endl; A* pa = NULL; pa = new A(10); cout<<pa->getI()<<endl; cout<<"pointer value"<<pa<<endl; pa->killself(); cout<<pa->getI()<<endl; cout<<"pointer value"<<pa<<endl; delete pa; pa = NULL; return 0; } ------------------------------------------ As I was expecting msvc6 gave dump at statement "a.killself();".But if I comment this line I get dump at "delete pa;". I am unable to understand the behaviour.Can somebody help me understand what's going on? I think there was thread on similar topic,...

Re: to delete or not to delete outliers for extremly skewed #2
sofiane <mesbah.sofiane@GMAIL.COM> wrote >i have some extremly skewed variables, if i have to build a predictive >model, should i remove these outliers and made a specific scorecard or >recode them and put them as category or do something else? What are you predicting and what variables are you using to predict with? Which are skewed? Why are thy skewed? Why do you think you have outliers, rather than a skewed distribution? Have you considered transforming them? What sort of model are you building? If you are doing some kind of regression, have you considered robust regression? Have you considered regression or classification trees? Without knowing this sort of thing, it's pretty much impossible to give good advice. For more of my advice on how to ask a statistics question, please see http://www.sascommunity.org/wiki/How_to_ask_a_statistics_question Thanks! Peter Peter L. Flom, PhD Statistical Consultant www DOT peterflom DOT com ...

delete records using querydef with parameter deletes ALL records
Hello, I have a table : Batch It contains fields batchnummer : Number (Long Integer) datum : Date/Time status : Number (Long Integer) nr_records : Number (Long Integer) It contains a number of records and I want to delete the record with a specific batchnummer eg 89 I created a querydef "Delete Batch by Batchnummer" PARAMETERS batchnummer Long; DELETE * FROM batch WHERE batchnummer=[batchnummer]; This is the VB code I used Sub doit() Dim qd As QueryDef Set qd = CurrentDb.QueryDefs("Delete Batch by Batchnummer") qd.Parameters("batchnummer") = 89 qd1.Execute End Sub After running this procedure ALL records are gone from the Batch table. I also tested this for other similar tables and I had the same problem. If I use a 'normal' query which selects records (no deletion) AND I use a recordset (qd.openrecordset(...)) then it seems to work. But I can't use a recordset when I want to do a delete. I know, I can use a construction where I create a string containing the where clause and run it using docmd.RunSQL but I'm just wondering why this doesn't work. Thanks Hans I don't use parameter queries much myself, but have you tried... Sub doit(bNum As Long) Dim sqlStr As String Dim db As Databse Set db=CurrentDB sqlStr ="DELETE batchnummer.*, batchnummer.batchnummer FROM batchnummer WHERE" sqlStr =sqlStr & " (batchnummer.batchnummer = " & ...

Delete action in subform trying to delete multiple records
In a subform I have a simple SQL statement that links an order details table to a product table. The form is used to enter order details. Most fields are obviously from the details table, with only a UOM field from the product table. This has worked fine for years, I thought. The problem I seem to have is that if the user makes a mistake in putting a product in the order they then naturally want to delete the line out of the order. However, when they try this they now get a message that the detail record can't be deleted due to related records in the 'Production' table. The production table isn't even in the query statement. I assume that besides deleting the detail record it is also trying to delete the product record which is linked to the production table. I have tried to find info about how Access determines what to delete in a query where there is more than one table involved. Which table does it delete from? The confusing bit is that I am sure this problem didn't exist before as I have had no reports from users and have not modified this area recently. Maybe users just didn't report this issue and worked around it...!! Anyway, any help appreciated. Jeff Pritchard ________________ Asken Research Pty. Ltd. Access Database Developers http://www.asken.com.au Jeff wrote: > In a subform I have a simple SQL statement that links an order details table > to a product table. The form is used to enter order details. Most fields...

Overloaded global delete is used instead of orignal global delete[]
Hi, It seems that overloaded global delete is used instead of orignal global delete[] in program below. Any suggestions? Thanks // =========================================== // File foo1.cpp #include <memory> #include <iostream> #define SHOW_FUNC std::cout << "Line-" << __LINE__ << ": " << __PRETTY_FUNCTION__ << std::endl // --------------------------------- // Global delete // --------------------------------- void operator delete(void *i_p) { SHOW_FUNC; // Line-13 // Do something free(i_p); } // --------------------------------- struct Foo { }; // ==================== int main() { Foo* p = ::new Foo[2]; ::delete [] p; return 0; } // =========================================== Linux gcc version 4.1.2 20080704 (Red Hat 4.1.2-52) > g++ foo1.cpp // No errors Output Line-13: void operator delete(void*) // So, overloaded global delete is used instead of orignal global delete[] ? Alex Vinokur <alex.vinokur@gmail.com> writes: > It seems that overloaded global delete is used instead of orignal > global delete[] in program below. ::delete[] p calls the default ::operator delete[](void*), which then calls your ::operator delete(void*) as required by C++11 [new.delete.array]. On Jun 15, 9:56=A0am, Kalle Olavi Niemitalo <k...@iki.fi> wrote: > Alex Vinokur <alex.vino...@gmail.com> wr...

Row handle invalid/referred to a deleted row or row marked for deletion
Hi, I'm getting the above error(s) using an ADP/ADE file linked to an SQL server database. The problem is that I can't for the life of me work out how/why it is occuring! It only happens on one subform, who's source is a simple stored procedure which returns the values from a single table. The error doesn't happen all of the time, and if it comes up, the user can usually close the application, come back in and edit the data with no problems whatsoever.. Any ideas as to why this could be happening? Cheers, Chris ...

Howto: Delete a file member from a C program?
Hi folks - I'm a complete os400 newbie, but I know a bit about C. I need to write a bit of code to delete a file member. Can I use the standard C library function "unlink" to do that? How do I reference the file member in the name string? My guess is unlink("<library>/<file>.<member>"); Would that work safely? Otherwise, is there a "proper" way to do this from a C program? TIA, JohnO "JohnO" <john@nospam.com> wrote in message news:na_cd.140$_l2.10933@news.xtra.co.nz... > Hi folks - I'm a complete os400 newbie, but I know a bit about C. > > I need to write a bit of code to delete a file member. Can I use the > standard C library function "unlink" to do that? How do I reference the file > member in the name string? My guess is > > unlink("<library>/<file>.<member>"); > > Would that work safely? > > Otherwise, is there a "proper" way to do this from a C program? > > TIA, > JohnO > > On further digging I suspect the format is: unlink("library/file(member)"); JohnO wrote: > "JohnO" <john@nospam.com> wrote in message > news:na_cd.140$_l2.10933@news.xtra.co.nz... > >>Hi folks - I'm a complete os400 newbie, but I know a bit about C. >> >>I need to write a bit of code to delete a file member. Can I use the >>standard C library function "...

O.T. I deleted everything in c:\ ... Content.IE5
Other than better performance (in some cases) and more disk space (I recovered 3-gigs) ==> what should I expect? Some sites I revisit may take a bit longer by reason of having to re-download some data. Might there be any other gotchas? what? You couldn't find the F1 key again? Or the IE NG? Looks like Terry's MLH object model was right on target. MLH <CRCI@NorthState.net> wrote in news:3silg2t7pv0kivdgmhcp232uvqarfbccqb@ 4ax.com: > Other than better performance (in some cases) and more disk space > (I recovered 3-gigs) ==> what should I expect? Your spouse is likely to kiss the disk drive good night in the evenings, not being able to differentiate between it and your head quite so easily now. -- Lyle Fairfield MLH wrote: > Other than better performance (in some cases) and more disk space > (I recovered 3-gigs) ==> what should I expect? Some sites I revisit > may take a bit longer by reason of having to re-download some data. I have a scab. Is it OK to scratch it? -- Tim http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me Tim Marshall wrote: > MLH wrote: > > Other than better performance (in some cases) and more disk space > > (I recovered 3-gigs) ==> what should I expect? Some sites I revisit > > may take a bit longer by reason of having to re-download some data. > > I hav...

http://LongPathTool.com - LONG PATH Tool
http://LongPathTool.com - LONG PATH Tool - Windows tool to copy or delete files and folders with path too long error Windows tool to copy or delete files and folders with path too long or filename too long error. Just browse to the file and press a button to copy or detele it, thats it! The application solves the problem with inability to copy and delete files and folders with long paths in Explorer. They could be created by virus/adware/Mac OS/other software. Normally one can't access such files under Windows and therefore can't copy or delete them either. Clean up files. Alows to copy and delete files that has path longer then 260 characters. Alows to copy and delete files that has trailing spaces or trailing dots in its name. If you have ever received a message from Windows like Cannot delete file: Access is denied There has been a sharing violation. The source or destination file may be in use. The file is in use by another program or user. Make sure the disk is not full or write-protected and that the file is not currently in use. Error Deleting File or Folder Cannot delete file or folder The file name you specified is not valid or too long. Specify a different file name. when you tried to delete, move or rename a file, then this program will be helpful. Path Too Long Utility identifies the processes (running programs) that have locked that file, preventing it from being deleted, moved or renamed. Recent changes: Demonstration o...

delete record
please help i was trying to delete a specific record on a table but it still shows the same record that should be deleted. i dont know how. bhetong22@yahoo.com (bher2) wrote in message news:<f34a4b26.0401272320.6f8cd318@posting.google.com>... > please help > > i was trying to delete a specific record on a table but it still shows > the same record that should be deleted. i dont know how. How are you deleting it? How are you seeing it? Try something like this from Query Analyzer: delete from dbo.MyTable where MyPrimaryKeyColumn = ... select * from dbo.MyTable where MyPrimaryKeyColumn = ... Simon bher2, There may be several reasons for this. Here are some ideas: - Do a select before you do the delete. See if that brings up the records you think it will bring up. - Try the select, then the delete in SQL Query analyzer. If you are doing this in an application, you might not be seeing any errors that come up, like foreign key errors. - Try grabbing the PK first for the record(s) you want to delete, if there is one and then delete by PK. - Try updating the statistics on the table. If they are "broken", your db might not be finding the record(s) you expect, if any. Hope that helps, Best regards, Chuck Conover www.TechnicalVideos.net "bher2" <bhetong22@yahoo.com> wrote in message news:f34a4b26.0401272320.6f8cd318@posting.google.com... > please help > > i was trying to delete a specific record on a table but it ...

Delete file
How can I test to see if a given file exists in my app directory and delete it if it does? Also can I rename a file? In article <MPG.1ab1bd06a7b183d59896be@netnews.comcast.net>, me@myprovider.com says... > How can I test to see if a given file exists in my app directory and > delete it if it does? Also can I rename a file? > Never mind again. It has been a long week combined with the fact that I shoudl be hospitaklized for as sick as I am right now. Thanks for tolerating my stupidity. Name "old" as "new" Kill "bad" ...

delete from database
I have code that does not delete from a database. The same code (cut an paste in the same file, but different function and having a different query) works. So, of course, I tested the query interactively. I echoed the query and did a cut and paste when interactively connect to the database. That one worked so it isn't the query since interactively it is seeing exactly the same thing as the code produces. Here is the code: function deleteCatalog($catalog) { $query = "DELETE FROM CatalogNames WHERE sCatalogID='" . $catalog . "'"; mssql_select_db($database_Login, $_SESSION['Login']); $result = mssql_query($query, $Login); ... } The $query echos: DELETE FROM CatalogNames WHERE sCatalogID='CMP' As an example of code that works (in the same file) function addToCatalog($cat_id, $cat_name) { $query = "INSERT INTO CatalogNames (sCatalogID, sCatalogName) " . "VALUES ('" . $cat_id . "', '" . $cat_name . "')"; mssql_select_db($database_Login, $_SESSION['Login']); $result = mssql_query($query, $_SESSION['Login']); ... } The second and third lines are identical (cut and pasted) as in other places in the same code. In fact, it is only in this file that I do all the database work. Every other function works. This is the only delete, however. Any ideas? Shelly Sheldon Glickler wrote: > I have code that does not delete from a da...

Delete question
I am new owner of Palm Zire and am wondering if there is any way to easilt delete old datebook entries? On Fri, 24 Oct 2003 10:19:57 -0700, David Silverman said... > I am new owner of Palm Zire and am wondering if there is any way to > easilt delete old datebook entries? > > In both the desktop and the Palm, one of the menu selections is Purge. Click on it and select how much to delete. If you want a different range of dates than those presented, go into the Prefs app and change the date. This is all in the manual. If you did not get the manual you can download it for free here; <http://www.palmone.com/us/support/zire/> -- Jim Anderson, Omphaloskepsis apprentice (@) ( 8(|) To e-mail me, just pull 'my_finger' ...

how to delete a file
How can I delete a file in C++? thanks, marc Rob Williscroft wrote: > Marc Schellens wrote in news:3F132491.5070901@hotmail.com: > > >>How can I delete a file in C++? >>thanks, >>marc >> >> > > > #include <cstdio> > > int main() > { > std::remove("filename.ext"); > } > > HTH thanks, it did. But isn't there a pure C++ way? As I understood, cstdio is deprecated. marc ...

deleted files
I have no recall deleting these files (a directory) they disappeared since last night. I wouldn't delete them unless I was mad They were on my data drive which is now unmounted. I have run debugfs on the partition /dev/sdb1 and it reports no deleted inodes. ecfsck also says the device is clean Any ideas or clues where to go from here -- faeychild On Mon, 17 Sep 2007 10:07:53 +1000, faeychild rearranged some electrons to say: > I have no recall deleting these files (a directory) they disappeared > since last night. I wouldn't delete them unless I was mad > > They were on my data drive which is now unmounted. > > I have run debugfs on the partition /dev/sdb1 and it reports no deleted > inodes. > > ecfsck also says the device is clean > > Any ideas or clues where to go from here Restore them from your most recent backup. faeychild wrote: > I have no recall deleting these files (a directory) they disappeared since > last night. I wouldn't delete them unless I was mad > > They were on my data drive which is now unmounted. > > I have run debugfs on the partition /dev/sdb1 and it reports no deleted > inodes. > > ecfsck also says the device is clean > > Any ideas or clues where to go from here http://www.ext3cow.com if it is formatted ext3 as that is the original 'go back' machine. david wrote: > On Mon, 17 Sep 2007 10:07:53 +1000, faeychild rearranged some electrons to ...

SQL delete
I am trying to delete records in one file based on criteria in a second file. I have the select running, and it select the proper records. I'm trying to figure the syntax of the delete. The select : select * from SLALLO, MBADREP where ADAKDT > 1040731 and ADUUQ1 > 0 and ADZ93N < ADUUQ1 and ADA3CD like '4%' and ADAENB=CONO and ADDCCD=ORTP and ADCVNB=ORDNO and ADFCNB=ITMSQ and ADHFCD < '50' order by ADCVNB The ADxxxx fields are from file MBADREP, the others from file SLALLO. I want to delete the SLALLO records that meet the where criteria. My first attempt was (but failed syntax) - I tried several versions, but I'm missing something here. delete from SLALLO, MBADREP where ADAKDT > 1040731 and ADUUQ1 > 0 and ADZ93N < ADUUQ1 and ADA3CD like '4%' and ADAENB=CONO and ADDCCD=ORTP and ADCVNB=ORDNO and ADFCNB=ITMSQ and ADHFCD < '50' Terence, SQL can't handle what you want to do. You can't do a join during a delete. You will need to make use of a subselect with an "in" or "exists" predicate. For example, say I want to delete all order detail lines for orders more than a year old. Problem is the order date only appears in the order header file. So I'd need to to the following subselect: delete from orderdtl where ordernbr in (select ordernbr from orderhdr where orderdate...

Web resources about - delete on delete ! - comp.lang.c++

Delete key - Wikipedia, the free encyclopedia
, known less ambiguously as forward delete ) discards the character ahead of the cursor 's position, moving all following characters one position ...

Facebook Fined $77K by Argentine Court for Failing to Delete Alleged Defamatory Groups
... mess in Argentina , as PanAm Post reported that a Rosario court ordered the social network to pay compensation of $77,000 for failing to delete ...

Facebook adds search history to Activity Log so users can delete queries
... in users’ Activity Logs. The feature will be rolled out to all users in the next few weeks. The feature allows for users to view and delete ...

Tweets MPs Delete (@deletedbyMPs) on Twitter
Sign in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here Tweets MPs Delete @ deletedbyMPs ...

Oren Jacob's answer to Pixar Animation Studios: Did Pixar accidentally delete Toy Story 2 during production ...
Oren Jacob's answer: Hi everyone, I'm the Oren Jacob in the video. Hopefully I can offer some first person color commentary about the video above ...

Delete Quickly - The Ultimate Contacts Manager for Cleaning up on the App Store on iTunes
Get Delete Quickly - The Ultimate Contacts Manager for Cleaning up on the App Store. See screenshots and ratings, and read customer reviews. ...

Delete, and I mean it! - Flickr - Photo Sharing!
I bought a new keyboard at work because I spilled cereal on the previous one and some of the keys stopped working. The new one has a giant delete ...

Rob Kardashian and Blac Chyna Split? They Delete Each Other on Instagram
Rob and his model girlfriend remove any references to each other on Instagram after dating only for a couple of months.

Delete locked Registry keys with Registry DeleteEx
... removing malware or other stubborn applications, but it’s not always easy. If the key is locked then you might see errors, or find your delete ...

Microsoft deletes racist, genocidal tweets from AI chatbot Tay - Business Insider
"Tay" says she supports genocide and hates black people.

Resources last updated: 3/30/2016 11:40:03 AM