delete

RoR / Ruby delete nil elements from nested array

in a previous question i asked how to split an array into two equal pieces in ruby on rails. this is how i did it: >> a = [1,2,3,4,5] => [1, 2, 3, 4, 5] >> a.in_groups_of( (a.size/2.0).ceil ) if a.size > 0 => [[1, 2, 3], [4, 5, nil]] now i've got a nested array that contains nil elements if the size of the array is odd. how can i remo...

Transaction : Delete related records from multiple tables using subsonic T4 templates?

Hi, Using templates, how can I delete related records from multiple tables in a transaction? Please advise. Thanks Pankaj ...

Fatal error: Call to a member function prepare() on a non-object

Hi, We have a Document Management application. I have 5000 image files loaded in mysql DB. Need to delete them when the folder is deleted at the client. Using the following code, public function delete($dbh){ $sql = "DELETE FROM fileTable WHERE FID=:fid; DELETE FROM file_blobTable WHERE FID=:fid"; $stmt = $dbh -> p...

Batch : recursively delete all folders starting with ...

I need to write a command in a .bat file that recursively deletes all the folders starting with a certain string. How may I achieve this ? ...

Error when deleting from an NSFetchedResultsController controlled UITableView outside of the table view

I'm trying to remove an object managed by an NSFetchedResultsController in a UITableView - and I'm attempting to do so from a separate view via add/remove buttons. However, it seems as though controller and table are getting out of whack as I switch between views and I can't quit figure out why. Here is the error I am getting - unfortu...

Deleting from ArrayList Java

Hi, I'm trying to delete an item from an array list by selecting it from a JList and clicking "Delete"...... The code i have so far is buttondeleteContact.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (contactList.getSelectedIndex() != -1) { people.removeElementAt(contactLis...

How do I delete an instance of an intermediate model in a Django Many-to-many relationship?

According to an example at http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships I have three models: class User(models.Model): name = models.CharField(max_length=128) class Group(models.Model): name = models.CharField(max_length=128) members = models.ManyToManyField(User, through...

X-HTTP-Method-Override in jQuery?

How can I do an X-HTTP-Method-Override for an ajax request in jQuery? ...

DataMapper has n through Resource DELETE (Remove from association) not working

Hi, I'm have this two classes class User include DataMapper::Resource property :id, Serial property :name, String has n :posts, :through => Resource end class Post include DataMapper::Resource property :id, Serial property :title, String property :body, Text has n :users, :through => Resource end So onc...

Auto-tab and delete button with jQuery

I'm working to replicate the iPhone unlock screen using jQuery. I'm having trouble implementing auto-tab and a delete button for the passcode unlock page. Not Solved Also, how can I implement a delete button which auto-tabs backwards while clearing input fields? $("#keypad li a.delete").click(function() { $("input.focus").val("")....

nAnt Deleting files older than 7 days old

I would like to create a target that cleans log files older than 7 days old in a specific folder. I get an error when I try to put in a "date" element inside a fileset. How can I go about this? <delete> fileset basedir="${StageIISRoot}/MySite/App_Data/ErrorLog"> <date datetime="${datetime::now() - timespan::from-days(7)}" when=...

Batch : script deleting itself

I have a .bat script launching a java program. The java program deletes the folder where the .bat sits. I have no way to touch the java program. I only can modify the .bat file. The problem is that the .bat file, once deleted, stops its execution right away without finishing. But there are some cleanup tasks to be done after the java ...

Question about Tortoise SVN Repo-Browser

Hi, i was wondering if i right click on a file in the SVN repo browser, does it get permanently deleted? can it be recovered? Thanks. ...

How do you enable LIMIT for DELETE in SQLite?

Using PHP, I have a simple database that may store multiple items with the same content. I want to delete the first occurrence of an instance when I use DELETE. How do you enable LIMIT for DELETE in SQLite using PHP? ...

[PHP] Retrieving and writing a file to system

What's the simplest way for me, in PHP, to: Retrieve a file from an external URL (http://test.com/thisfile) If successful, delete local file /root/xml/test.xml Rename downloaded file to test.xml Write new file to /root/xml/ folder This will be a private script, so security or error handling are not important concerns. ...

Deleting Database Rows and their References-Best Practices

How do I go about deleting a row that is referenced by many other tables, either as a primary key or as a foreign key? Do I need to delete each reference in the appropriate order, or is there an 'auto' way to perform this in, for example, linq to sql? thanks. ...

Batch File/Script to delete Several non sequential lines from text file(s)

I have read the suggestion listed here. http://stackoverflow.com/questions/418916/delete-certain-lines-in-a-txt-file-via-a-batch-file The batch file solution seems to work untill i get to about 5 ignore conditiobal strings and then the output starts to ignore very large sections of the text files(s) even things it shouldn't. Basically...

How to add a warning modal to delete

I have the following MySQL for a delete button. DELETE FROM mytable WHERE id = $id I want to add a jquery modal to confirm to proceed. "Are you sure to delete? Yess | No" If you click YES then it will execute to delete, if it is NO then exit the modal and go back to the page. --Updated-- The id in each ancho is added dynamically. ...

overloading new and delete problem

Hi! I try to follow this article: http://flipcode.com/archives/How%5FTo%5FFind%5FMemory%5FLeaks.shtml to overload my new and delete functions in order to track memory leaks. however - if i try to compile, I get a C2365: "operator new": redefinition; previous definition was a "function" in the file xdebug xdebug gets included in xlo...

Deleting node from linked list in C

Okay this is my code for deleting a node from a linked list. vec_store holds seq and size. Variable seq holds the vectors and a pointer. For some reason, the else if(i<s->size-1) doesn't work which is the last condition. Any1 can solve the problem? By the way this is C code. void delete_vec(vec_store s, int i) { if (i<0 || s->si...