w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Deleting a record with ember-model
Looking at the source code, it seams clear how ember-model does the DELETE operation: deleteRecord: function(record) { var primaryKey = get(record.constructor, 'primaryKey'), url = this.buildURL(record.constructor, get(record, primaryKey)), self = this; return this.ajax(url, record.toJSON(), "DELETE").then(function(data) { self.didDeleteRecord(record, data); }); } basically the resulting format is: DELETE /books/123 + JSON body. If your backend expects something else then the only way to change it would be to rewrite the deleteRecord for your custom needs. But IMO the simplest thing you could do is to just ignore the JSON body. Hope it helps.

Categories : Ember Js

Backbone:.js: How to find out who is deleting my model from my collection?
As noted above: If your view is listening to the destroy event. Then give it a callback method it. Put a debug point inside the event and check the call stack. You can find it on the right side in Source Tab of developer tools when in debug mode.

Categories : Jquery

Deleting NSManagedObject from core data while another model is using that object
You shouldn't be deleting the object if it is still actively being used. Or, when you want to delete it you should be ensuring that all other usage of it is terminated. Logically, what you describe doesn't make sense and I expect you're seeing exceptions when you try to update/save the object that has been deleted.

Categories : IOS

Ember.js - Creating/Editing and Deleting model using RESTAdapter
The fixture adapter doesn't make any calls back to the server, so it's harder to see, but if you look in the restadapter code you can see the calls that do the put/post/delete. updateRecord: This exsits on the adapter itself, really you should call save on a model and allow ember data to choose the updateRecord on its own. model.save() createRecord: this should be called from the Class App.KewlKidz.createRecord({id:3, name:"me"}); deleteRecord: call this bad boy on the model. model.deleteRecord() Rest Adapter Ember Data Model

Categories : Ember Js

AngularJS ng-model form driven by ng-repeat over UI model description data how to?
I've just figured out one (but may be not the best?) way to achieve this myself.. see http://jsfiddle.net/vorburger/8CxRC/3/ - basically still based on my square bracket dynamic keys 'trick', but with some pre-processing: for (var i = 0; i < $scope.uimodel.length; i++) { var resolvedModelProperty = $scope.datamodel; var remainingPath = $scope.uimodel[i].model; while (remainingPath.indexOf('.') > -1) { var nextPathSlice = remainingPath.substr(0, remainingPath.indexOf('.')); resolvedModelProperty = resolvedModelProperty[nextPathSlice]; remainingPath = remainingPath.substr(remainingPath.indexOf('.') + 1); } $scope.uimodel[i].modelB = resolvedModelProperty; $scope.uimodel[i].modelL = remainingPath;

Categories : Javascript

Edit attributes of a child model from the form representing parent model
Problem 1: delete adress on person deletion You can use post_delete signal to automatically delete the adress once your person is deleted. It's quite simple to use from django.db.models.signals import post_delete from web.programing.roxx.models import Person, Adress @receiver(post_delete, sender=Person, dispatch_uid="person_post_delete") def onPersonDelete(sender, instance, using, **kwargs): # be carefull, the instance doesn't exist anymore in the database adress_id = instance.business_Address.id if id != None: Adress.objects.filter(id=adress_id).delete() But this won't display the adress in the "Are you sure ?" message.. Problem 2: edit the adress in the person admin page For the moment, I don't see any solution simpler than building a custom form to edit Pers

Categories : Python

How to change form to deleting posts
Rather than having the value as part of a td add a hidden input element: <input type="hidden" name="id" value="<?php echo $article['article_id'];?>"> As it stands delete.php isn't receiving the id value.

Categories : PHP

Deleting form fields with jQuery
Use delegation, BTW, answer-delete element doesn't seem to have for parent .answer-holder element: $('#answers').on('click','.answer-delete', function () { $(this).closest('#answers').find('.answer-holder').remove(); return false; });

Categories : Jquery

How to embed a model's form in another model in Django?
A ForeignKey is simply a pointer to specific row in another table. What your Person model says is "Every person has one or two telephones. Each telephone is stored in another table called 'Phone'." So, unless you are doing something sophisticated, your Person form is asking you to associate two existing Phones for your new Person. (editing to respond to your comment). If what you want to do is to have multiple phones, then what you need is a formset The first thing you need to do is to change which table points at which: instead of the person pointing to a phone, the phone should point to a person. So, for example, add belongs_to = models.ForeignKey(Person) to your phone model declaration. The next step is to actually ask for the phones in your view. Here is where formsets come in. In

Categories : Django

Deleting Checked box data in Mysql Table from form
First of all you need to wrap the table into a form <div id="artikel-container"> <form name="form1" method="post" action="..."> <table class="table 1"> ... echo "</table></form>"; mysqli_close($con); Next you need the checkboxs on the form $row['ID'] is the primary key of the table echo "<td>" . $row['Aantekeningen'] . "</td>"; echo "<td><input type='checkbox' name='del[]' value='".$row['ID'] . "></td>"; echo "</tr>"; In the php file called in the form's action attribute: <?php if( isset( $_POST['del'] ) { $del = $_POST['del']; for(x=0; x<count(del); x++ ) { $sql = 'DELETE FROM BCD WHERE ID='.$del[$x]; //---execuste the query } } ?>

Categories : PHP

How to use ModelState to clear my form after I post my form data,my view model is a viewmodel which has two models?
In such case you will have to remove each property of StudentModel from your ModelState i.e. Syntax: ModelState.Remove("PropertyName"); Example: ModelState.Remove("Id"); ModelState.Remove("Name"); ModelState.Remove("Marks"); Edit: For specific model property in among two ModelState.Remove("StudentModel.Name");

Categories : Asp Net Mvc

Laravel 4: Can't get model data with a form macro on edit form
For reference if you want to check what the Form generates you can look up vendor/laravel/framework/src/Illuminate/Html/FormBuilder. In the FormBuilder class you'll find methods for the inputs. The method for the text input looks like this public function text($name, $value = null, $options = array()) { return $this->input('text', $name, $value, $options); } As you can see the second parameter is the value and the third is the options array. So for your form it would look like this Form::text('email', null, array('class'=>'m-wrap span12'))

Categories : PHP

Deleting Post Via Jquery Ajax when Submit Form is Pressed
You need to change the parent divs to have the class name as "post" rather than having same ids for all. Then you can bind all items which having the class "post" to submit function and in the function find each form as source of event and find the child to get the value. See live solution here: http://jsfiddle.net/vendettamit/nn9FV/ Update code is here: $(document).ready(function(){ $("div.post").submit(function(e){ console.log(e); var currForm = e.delegateTarget.firstElementChild; var postid = $(currForm).children('#postid').val(); var unique= $(currForm).children('#unique').val(); var str = 'unique='+ unique+ '&postid='+ postid; console.log(str) $.ajax({ type: "POST", url: "

Categories : PHP

Error in deleting/addind file from appharbor using git "Unable to create 'f:/git/xyz/WorkerProcess/.git/index.lock': File exists"
It works for me : $ git clean -f .git/index.lock Removing .git/index.lock comp1@SHAILESH01 /f/git/xyz/WorkerProcess (master) $ git init Reinitialized existing Git repository in f:/git/xyz/WorkerProcess/.git/ comp1@SHAILESH01 /f/git/xyz/WorkerProcess (master) $ git add . comp1@SHAILESH01 /f/git/xyz/WorkerProcess (master) $ git rm bin fatal: not removing 'bin' recursively without -r comp1@SHAILESH01 /f/git/xyz/WorkerProcess (master) $ git rm -r -f bin

Categories : GIT

Create a backup before deleting each file in a batch file
Just rename .txt-files to .txt.bkup, i.e.: rename *.txt *.txt.bkup If you insist on creating backups before deleting (for example, a configurable batch file, where creating backups may be switched off), then you can copy files before deleting: copy *.txt *.txt.bkup del *.txt

Categories : Windows

No such file or directory after deleting file , ruby on rails
I'm unsure overall what your logic means semantically, so there may be reasons why the file delete shouldn't be repeated, but the simple solution would be to check for the existence of the file before you delete it. file_name = 'C:/Sites/what2/uploadnew/' + f File.delete file_name if File.file? file_name Since it's a normal file, I'm suggesting to use .file? as opposed to exists?.

Categories : Ruby On Rails

Add form fields to single model form in rails
I recommend creating a grades model - it is the Rails way. A Grade can belong to an Application. An Application can have many Grades. Each Grade can then have two attributes - a class and a grade. Alternatively, you can store all your grades for a single application in a single column, but you'll be responsible for the format that they're saved in, ensuring that they are serialized at some point prior to being saved, parsing when you load each Application, etc. Finally, you'll be coming up with additional fields to deal with the parsed grades. All of this can be avoided by simply creating the Grade model and setting up the appropriate relationship with the Application model.

Categories : Ruby On Rails

Laravel 4 form model binding Form::select
I think your 3rd parameter in the select needs to be the selected value: {{ Form::select('gender', array('0' => 'What gender are you?', '1' => 'Male', '2' => 'Female'), $profile->gender) }} I know it kinda defeats the purpose of model binding but it will actually work. Other issue of course is that now you've lost your class! But if we have a quick look at the api: select( string $name, array $list = array(), string $selected = null, array $options = array() ) We see that you can pass your options array as the 4th argument. Therefore, the working code is: {{ Form::select('gender', array('0' => 'What gender are you?', '1' => 'Male', '2' => 'Female'), $profile->gender, array('class' => 'span12')) }}

Categories : Laravel

Deleting Grid View Row data wrongly Windows Form My Code Attached?
You need to clear the grid view data source before bind it.Please Refer this link to clear grid view. try this code Datagridview remove all columns public void FillCompanyInfo() { dataGridView1.DataSource = null; dataGridView1.Columns.Clear(); dtCompanyInfo = GetCompanyInfo(); if (dtCompanyInfo.Rows.Count > 0) { dataGridView1.DataSource = dtCompanyInfo; DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn(); checkColumn.Name = ""; checkColumn.HeaderText = "Select"; checkColumn.Width = 50; checkColumn.ReadOnly = false; checkColumn.FillWeight = 10; //if the datagridview is resized (on form resize) the checkbox won't take up too much; va

Categories : C#

Before creating the file , deleting the file of previous day
If you are using Java 7 then there is standard way to get file creation time, So that you can check if file is created in previous day and should be delete. Path path = Paths.get("/filepath/"); BasicFileAttributes fileAttributes = Files.readAttributes(path, BasicFileAttributes.class); System.out.println("creationTime:"+ fileAttributes.creationTime());

Categories : Java

How to preserve the Model.Context.cs file header content after updating model from db with Entity Framework?
For the added members, you can create another file that contains another partial of the class. This new file won't be overwritten so anything you've added there should persist between updates. For the changes that aren't new members (like the added line in the constructor), you can edit the Model.Context.tt file directly. This is a simple T4 Text Template used to re-generate the code when the model is updated. It is similar to an ASP.NET page; however, instead of using C# to generate HTML, it uses C# to generate more C#.

Categories : C#

Deleting file from ftp in C#
You'll need to use the FtpWebRequest class to do that one, I think. FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverUri); //If you need to use network credentials request.Credentials = new NetworkCredential(ftpUsername, ftpPassword); //additionally, if you want to use the current user's network credentials, just use: //System.Net.CredentialCache.DefaultNetworkCredentials request.Method = WebRequestMethods.Ftp.DeleteFile; FtpWebResponse response = (FtpWebResponse)request.GetResponse(); Console.WriteLine("Delete status: {0}", response.StatusDescription); response.Close();

Categories : C#

File not deleting
You may not have write permissions on that file. Here is how you can check write permissions on that file using File#canWrite before trying to delete that file: if (!file.canWrite()) { throw new RuntimeException("Sorry I don't have right permissions!"); } // now you can try to delete it if (file.exists()) { file.delete(); } EDIT: You also need read/write/execute permissions on parent directory. You can add these checks also: if (!file.exists()) throw new RuntimeException("file doesn't exist!"); File parent = file.getParentFile(); if (!parent.canRead() || !parent.canWrite() || !parent.canExecute()) throw new RuntimeException("Sorry I don't have right permissions on dir!"); if (!file.canWrite()) throw new RuntimeException("Sorry I don't have write permissio

Categories : Java

Libsvm model file format No model number
From the libsvm FAQ: Q: Can you explain more about the model file? In the model file, after parameters and other informations such as labels , each line represents a support vector. Support vectors are listed in the order of "labels" shown earlier. (i.e., those from the first class in the "labels" list are grouped first, and so on.) If k is the total number of classes, in front of a support vector in class j, there are k-1 coefficients y*alpha where alpha are dual solution of the following two class problems: 1 vs j, 2 vs j, ..., j-1 vs j, j vs j+1, j vs j+2, ..., j vs k and y=1 in first j-1 coefficients, y=-1 in the remaining k-j coefficients. For example, if there are 4 classes, the file looks like: +-+-+-+--------------------+ |1|1|1|

Categories : Machine Learning

Cakephp using model wtihout defining model file
Change it to: $test = $this->Test->find('all'); Also, please, check cakephp model and database conventions

Categories : PHP

Deleting a file from Git repo
Assuming you haven't made any further commits locally yet, I would back up and try again: git reset --hard HEAD^ # revert index and tree one commit - to before the rename git mv text.php unit_test.php # rename file in a manner git can track git commit # The rename should staged automatically git push

Categories : GIT

deleting a sql dump file
One solution to do this right, is (This is a rough example of how it could be done): Return the data from the database as an array, and iterate through it: // tell the browser that this is a download header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=list.csv"); // column separator $separator = ';'; // field delimiter $field_delimiter = '"'; // line end $line_end = " "; foreach ($result as $row): $i = 0; foreach ($row as $item): // do not add separator before the first item if ($i > 0) { echo $separator; } echo $field_delimiter.$item.$field_delimiter; $i++; endforeach; // line end echo $line_end; endforeach; Do not output anything else, just the CSV content.

Categories : PHP

Deleting a file in coldfusion
So you have a form plus a link. If the user selects the link, you want an alert to come up and if the user accepts, a file gets deleted on the server, but the user stays on the form? My approach would be: Put a 1 pixel iframe on your form page that contains the code to delete the file. For your anchor tag, have it link to javascript so that you can use the confirm popup. In the page that deletes the file, add some extra code that uses javascript to do something about the link on the form page. You can get rid of it completely, or replace it with a statement saying the file has been deleted. Note that step 3 will be easier if you have your link inside a <div>.

Categories : File

Deleting a file in Java
The file might be open by another process, you might not have sufficient rights to delete the file,... Edit: I also strongly recommend to use Automatic Resource Management wherever possible, to make sure your streams/ readers/ writers get properly closed.

Categories : Java

Error while deleting a file in C++
Two things jump out at me: 30 chars is not enough for most full paths. Also you should not use new if you can avoid it; fixed-length arrays can just as well go on the stack; and this is a job for std::string if ever there was one. You did not close the file before attempting to delete it. Platforms vary on this requirement but I think Windows does not like that. Destroy or close the stream before calling remove.

Categories : C++

Referencing a model's Show View form another model's Index view
color.color_name is giving you error because you don't have color object on Product Index View. Try <td><%= link_to product.color_name, product.color_name, color_path(product.color) %></td> if there is one-to-one relationship Try <td><%= link_to product.color_name, product.color_name, color_path(product.colors.first) %></td> if there is one-to-many relationship

Categories : Ruby On Rails

bundle update seems to be deleting my .gem file
Is the Gemfile that you're showing the one inside curriculous itself, or a second project that uses curriculous? If it's the one inside curriculous, then you should remove the gem 'curriculous', path: '/mydev/curriculous' line. That indicates that curriculous depends on itself, which is probably not what you mean :) Instead, add a line that has only gemspec. This tells Bundler to read the curriculous.gemspec file to find the dependencies for the project. There's a basic tutorial for creating gems at http://net.tutsplus.com/tutorials/ruby/gem-creation-with-bundler/ If that Gemfile is for a different project, then you're doing it correctly. Is there something that isn't working? Running bundle will rebuild the gem. The specifics of what it does depends on what version of RubyGems is act

Categories : Ruby

Deleting File which is displayed in picturebox
use this code string imgName = ofd.SafeFileName; if (Directory.Exists(path)) { var directory = new DirectoryInfo(path); foreach (FileInfo file in directory.GetFiles()) { GC.Collect(); GC.WaitForPendingFinalizers(); file.Delete(); } }

Categories : C#

Deleting the contents of the file not working
EDIT: Looking over your code again, I see the problem is that you are using the ios::app although you have also passed ios::in. ios::app -- All output operations are performed at the end of the file, appending the content to the current content of the file. This flag can only be used in streams open for output-only operations. http://www.cplusplus.com/doc/tutorial/files/ Old Post: Take a look at the following code example: #include <iostream> #include <fstream> #include <cstdio> #include <cstring> using namespace std; const char g_szTestData[] = "This is some test da$$$$######ta and some more" " tes$$$$######ting"; int main(int argc, char** argv) { fstream file("new.dat", ios::in|ios::out); file << g_szTestDa

Categories : C++

Deleting a line in a text file
So whats going on? Something like this: line = "----------------------------------- " => "----------------------------------- " a = line => "----------------------------------- " line.delete a ArgumentError: invalid range "-- " in string transliteration The error raised by the delete method is because dashes are used for special character-range syntax: "hellob".delete "a-e" => "hllo" Probably you want to be taking a different approach to solve your goal, but it is difficult to tell what you want, as you don't show what you want to do with the data once lines are removed. Simply processing the line variable just means you have an altered String at that point.

Categories : Ruby

completely deleting a file from server
open the file in binary mode for writing, write 1's over the entire file, close the file, and then unlink it. overwrites any data within the file so it cannot be recovered. Personally i would say use 1's instead of 0's as 1's are actual data and will always write, where as 0's may not write, depending on several factors. Edit: After some thought, and reading of comments, i would go with a hybrid approach, depending on "how deleted" you want the file to be, if you simply wish to make it so the data cannot be recovered, overwrite the entire files length with 1's as this is fast, and destroys the data, the problem with this, is it leaves a set length of uniform data on the disk which infers a file USED to be there and gives away the files length, giving vital pieces of forensic information.

Categories : PHP

File in use error when deleting a folder
It looks like the file is locked by some other process. This could happen if when reading/writing to it you forgot to dispose the stream reader/writer and you leaked the unmanaged handler to the file. For example if you used the following code to read from the file: StreamReader reader = new StreamReader(fileName); string contents = reader.ReadToEnd(); and you never release the reader, the file will be locked. The proper way is to wrap IDisposable resources such as Streams and StreamReaders in using statements: using (StreamReader reader = new StreamReader(fileName)) { string contents = reader.ReadToEnd(); } If on the other hand the file is locked by some other external process to your application then there's very little you could do about it, other than killing this process.

Categories : C#

Deleting Line from text file php
One approach could be to query the server with the string to be removed if no line can be equal to another one, e.g., delete.php?str=<your string> and do the deletion of that string (note that I said 'string' not line). If it's possible for lines to be equal, you should identify the lines and follow a similar approach: delete.php?line=<number>. This should be easy and you could write a flexible code that deletes lines from a giving file by also passing the filename. Edit: Example provided following the advise of using a hidden field. <?php $html = "<form id='form' method='post' action='delete.php'>"; foreach(array("line 1", "line 2", "line 3") as $key => $value ) { $html .= "<span>${value}</span>"; $html .= "<input type='hidden' name='line

Categories : PHP

I would like to stop carrierwave deleting a file
Keeping files for all, or some uploaders CarrierWave.configure do |config| config.remove_previously_stored_files_after_update = false end If you want to configure that on a per-uploaded basis: class AvatarUploader < CarrierWave::Uploader::Base configure do |config| config.remove_previously_stored_files_after_update = false end ... end

Categories : Ruby On Rails

Deleting item of listview from database but it is not properly deleting
The arg2 is NOT the ID of your item, take a look at the official documentation to understand what it is ! The arg3 is NOT the ID of your item in the database, but the row ID of the Android ressource (i.e. R.id.xxx), so you can't just use the data given by the parameters of onItemLongClick(). Knowing this, you can figure out that the line helper.deleteName((arg2+1)); is not correct and doesn't mean anything : arg2+1 means absolutely nothing for your database. A solution (not the best I think), should be to include an invisible field in your item view, storing the actual _id field of your database. Then, when a long press is detected, you get back this value and pass it to helper.deleteName().

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.