Questions tagged [destroy]

In object-oriented languages, objects need to be destroyed after their creation to free memory. Destruction can however have a broader meaning. Sometimes, destruction means that resources must be freed or that files must be deleted.

In object-oriented languages, objects need to be destroyed after their creation to free memory. This is not necessarily something that a programmer needs to explicitly instruct. Garbage collected languages such as Java or Python take care of object destruction for you. Other languages such as C++ require the programer to destroy objects explicitly.

Destruction can however have a broader meaning. Sometimes, destruction means that resources must be freed or that files must be deleted.

982 questions
8
votes
2 answers

where to get the record id when calling backbone.js destroy

I have some test code that i'm just trying to use to figure out backbone.js. when i call destroy on a model object backbone makes a DELETE request to my rest service. but, i can't see any ID indicating which record is being deleted in the request…
Jason
  • 1,726
  • 17
  • 19
8
votes
1 answer

Destroy/reset singleton in laravel way

public function register() { $this->app->singleton('Qwerty', function ($app) { return new QwertyManager(); }); } This is what my singleton class looks like now i want to reset the singleton object or destroy its instance via…
ujwal dhakal
  • 2,289
  • 2
  • 30
  • 50
8
votes
3 answers

Is it necessary to destroy a tooltip?

In my application I am handling the WM_HELP message and then creating a tooltip for a control using this method: Taken from: http://msdn.microsoft.com/en-us/library/bb760252(v=vs.85).aspx HWND CreateToolTip(int toolID, HWND hDlg, PTSTR pszText) { …
Favonius
  • 13,959
  • 3
  • 55
  • 95
8
votes
2 answers

How do I trigger destroy callbacks for an object which is part of a join model that automatically deletes that object?

Rails 2.3.8. I have 3 models, User, Source, and Subscription. User attr_accessible :source_ids has_many :subscriptions has_many :sources, :through => :subscriptions Source has_many …
Eric
  • 1,235
  • 2
  • 13
  • 26
8
votes
2 answers

Destroy not destroying GameObject

I have the following code in Unity3D for adding and deleting a line segment for a 3D drawing: public class LinearPiecewiseTrajectory : MonoBehaviuor { private List lineSegmentRep; //other stuff here public void…
user650261
  • 2,115
  • 5
  • 24
  • 47
8
votes
1 answer

Does $scope.$on('$destroy', ...)'s event handler get destroyed?

Ran across a very "down-the-rabbit-hole" Angular question today I couldn't find the answer to. From the $scope docs, you can register an event handler on "$destroy", which is called right before a scope's destruction. That way, you can deregister…
jdotjdot
  • 16,134
  • 13
  • 66
  • 118
8
votes
2 answers

How would I make destroy() method in tkinter work with my code?

from tkinter import * class GameBoard(Frame): def __init__(self): Frame.__init__(self) self.master.title("test") self.grid() #button frame self.__buttonPane = Frame(self) self.__buttonPane.grid() #buttons …
Victor Oza
  • 97
  • 1
  • 1
  • 4
8
votes
2 answers

Spring shutdown event that fires immediately before ApplicationContext is destroyed?

I am looking for an interceptor or a trigger to know that, all the context beans are destroyed and the applicationcontext instance is about to destroy itself. So I can do one process at the end of the application lifetime. There is this event type…
Neron
  • 1,500
  • 7
  • 30
  • 52
8
votes
2 answers

has_many through association dependent destroy under condition of who called destroy

Is there a way to check, within a before_destroy hook, what object (class) called destroy? In the following example, when a patient is destroyed, so are their appointments (which is what I want); however I don't want to allow a physician to be…
user664833
  • 18,397
  • 19
  • 91
  • 140
7
votes
3 answers

Deleted migration.rb file? Potential bug in rails?

I am not sure if this is a bug or if this actually removed a migration.rb file. I used generate to create the following migration: $ rails generate migration add_delta_to_submissions invoke active_record create …
7
votes
3 answers

How to destroy a Node.js http.request connection nicely?

If I run it in the command line, the program will stop after client.destroy(); var client = http.get(options, function(res) { console.log(res.statusCode); client.destroy(); } ); However, it is not the case…
murvinlai
  • 48,919
  • 52
  • 129
  • 177
7
votes
7 answers

Destroy and recreate a jQuery Datatables

I have two jQuery datatables with server side processing. I have a checkbox where I hide and show the two tables. I would like to destroy the none displayed and create another table. How would I do this? This is what I tried but ajax.reload does not…
fefe
  • 8,755
  • 27
  • 104
  • 180
7
votes
1 answer

Sequelize how to return destroyed row

Here is my code for deleting rows in database Model.destroy({ where: { ... } }).then((response) => { console.log(response) }) What I am getting in console.log is 0 or 1 whether record deleted or not.. Is it any way to return destroyed…
Devsullo
  • 864
  • 1
  • 9
  • 14
7
votes
2 answers

Override UP button in action bar

i'd like to avoid parent activity being destroyed whenever i clicked < button in action bar. which method is being called from AppCompatActivity when we press that button? is there a way for me to override it? and is there a way to override for all…
Yoh Hendry
  • 417
  • 6
  • 15
7
votes
2 answers

Why is object destructor not called when script terminates?

I have a test script like this: package Test; sub new { bless {} } sub DESTROY { print "in DESTROY\n" } package main; my $t = new Test; sleep 10; The destructor is called after sleep returns (and before the program terminates). But it's not…
planetp
  • 14,248
  • 20
  • 86
  • 160