Search Results

Search found 7702 results on 309 pages for 'django validation'.

Page 133/309 | < Previous Page | 129 130 131 132 133 134 135 136 137 138 139 140  | Next Page >

  • jQuery validation plugin: valid() does not work with remote validation ?

    - by a-dilla
    I got started by following this awesome tutorial, but wanted to do the validation on on keyup and place my errors somewhere else. The remote validation shows its own error message at the appropriate times, making me think I had it working. But if I ask specifically if a field with remote validation is valid, it says no, actually, its not. In application.js I have this... $("#new_user").validate({ rules: { "user[login]": {required: true, minlength: 3, remote: "/live_validations/check_login"}, }, messages: { "user[login]": {required: " ", minlength: " ", remote: " "}, } }); $("#user_login").keyup(function(){ if($(this).valid()){ $(this).siblings(".feedback").html("0"); }else{ $(this).siblings(".feedback").html("1"); } }) And then this in the rails app... def check_login @user = User.find_by_login(params[:user][:login]) respond_to do |format| format.json { render :json => @user ? "false" : "true" } end end I think that my problem might have everything to do with this ticket over at jQuery, and tried to implement that code, but, being new to jQuery, it's all a bit over my head. When I say bit, I mean way way. Any ideas to fix it, or a new way to look at it, would be a big help.

    Read the article

  • How does key-based caching work?

    - by Dominic Santos
    I recently read an article on the 37Signals blog and I'm left wondering how it is that they get the cache key. It's all well and good having a cache key that includes the object's timestamp (this means that when you update the object the cache will be invalidated); but how do you then use the cache key in a template without causing a DB hit for the very object that you are trying to fetch from the cache. Specifically, how does this affect One to Many relations where you are rendering a Post's Comments for example. Example in Django: {% for comment in post.comments.all %} {% cache comment.pk comment.modified %} <p>{{ post.body }}</p> {% endcache %} {% endfor %} Is caching in Rails different to just requests to memcached for example (I know that they convert your cache key to something different). Do they also cache the cache key?

    Read the article

  • Should I work on CSS or apps first?

    - by Fred
    I am working on my own website for my business, and I need to contract out some assistance. For example, I have the site looking pretty good on Firefox, but it needs help on other browsers. I also need some help with adding some Django apps to the site and setting up a database. I plan to seek the help of two different individuals via elance or odesk. My question is which to do first - get the css and html right then do the apps, or get the apps done and then work on the css and html? Thanks in advance for any suggestions.

    Read the article

  • How do I learn Python from zero to web development? [closed]

    - by Terence Ponce
    I am looking into learning Python for web development. Assuming I already have some basic web development experience with Java (JSP/Servlets), I'm already familiar with web design (HTML, CSS, JS), basic programming concepts and that I am completely new to Python, how do I go about learning Python in a structured manner that will eventually lead me to web development with Python and Django? I'm not in a hurry to make web applications in Python so I really want to learn it thoroughly so as not to leave any gaps in my knowledge of the technologies involving web development in Python. Are there any books, resource or techniques to help me in my endeavor? In what order should I do/read them? UPDATE: When I say learning in a structured manner, I mean starting out from the basics then learning the advanced stuff without leaving some of the important details/features that Python has to offer. I want to know how to apply the things that I already know in programming to Python.

    Read the article

  • TTS on App Engine

    - by yati sagade
    I have written a small front-end to the Festival TTS system using Python/Django. I wish to deploy it on the Google App Engine cloud. A few questions: My application uses the Festival app 'text2wave'. Will is work on the cloud? I have used Python primitives like subprocess.call() to invoke the aforementioned program. Will that work? If your answer to any or both of (1) and (2) is no, is there a free api on the web that I can use (from the appengine)? I read somewhere about placing calls from Phono to a Voxeo backend, but I'm not sure what that means. I am aware of the Google Translate extension that allows translation using an HTTP GET (REST) request, but here the text is limited to 100 chars. Bad. Plus, they may take it down any point of time.

    Read the article

  • 'module' object has no attribute 'PY2'

    - by ManikandanV
    I am using ubuntu 14.04, was trying to install python-memcache. I have got an error like Downloading/unpacking python-memcached Downloading python-memcached-1.53.tar.gz Cleaning up... Exception: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1229, in prepare_files req_to_install.run_egg_info() File "/usr/lib/python2.7/dist-packages/pip/req.py", line 292, in run_egg_info logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name)) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 284, in setup_py if six.PY2 and isinstance(setup_py, six.text_type): AttributeError: 'module' object has no attribute 'PY2' Storing debug log for failure in /home/mani/.pip/pip.log I am getting the same error when installing Django-celery, pymongo etc

    Read the article

  • Google Apps, SPF, softfail problem (validates with validation tools, but still softfails otherwise)

    - by mq.chen
    Hi, I guess this is probably a commonly asked and boring question but I'm really at a loss and I don't know what else to do. This might be a duplicate of other questions, but none of the solutions worked for me. I've Googled around and read just about anything I could find but I'm still puzzled as to why it doesn't work. The gist of my problem is that I have set-up Google Apps for a client of mine with the domain fintan.dk. Everthing works just excellent, except emails sent from *@fintan.dk (either with the Gmail web-interface or desktop client) to a non-Google Apps email gets a softfail (I have sent to my University email, an email hosted at MediaTemple and even Hotmail). The emails gets a pass when sent to a Google Apps or Gmail address though... (All emails from that domain are sent via email clients.) So this is what I have done so far: I've added the SPF record Google recommended (v=spf1 include:_spf.google.com ~all), waited several days hoping it would a DNS update delay problem. Now, three days later there is no change. I have verified the settings in the desktop clients several times. I have validated the records with validation tools like the SPF Query Tool, [email protected] and [email protected]. All of them validate and gives a pass, saying there shouldn't be a problem, but strangely there still is. So, I really don't know what else to do. Any help is very much appreciated. Thank you in advance!

    Read the article

  • How do you handle domain logic that spans multiple model objects in an ORM?

    - by duality_
    So I know that business logic should be placed in the model. But using an ORM it is not as clear where I should place code that handles multiple objects. E.g. let's say we have a Customer model which has a type of either sporty or posh and we wanted to customer.add_bonus() to every posh customer. Where would we do this? Do we create a new class to handle all this? If yes, where do we put it (alongside all the other model classes, but not subclass it from the ORM?)? I'm currently using django framework in python, so specific suggestions are even more wanted.

    Read the article

  • What kind of authorization I should use for my facebook application

    - by JSmith
    I am building a social reader Facebook application using Django where I am using Google Data API (Blogger API). But I am unable to deal with the authorization step to use the API (currently using ClientLogin under development). I tried to read the OAuth documentation but couldn't figure out how to proceed. I don't want my users to provide any login credentials for google.. which makes the app completely absurd. So, can anyone help me on my project and tell me what kind of authorization I should actually use and how ? (I am using gdata lib)

    Read the article

  • TGT validation fails, but only for one user

    - by wzzrd
    I'm seeing the weirdest thing here. I have a couple of RHEL3, 4 and 5 machines that validate user credentials through Kerberos with an Active Directoy domain controller as their KDC. This works for all of my users, save one. There is one account that is unable to log into RHEL3 Linux machines and generates the following errors there: May 31 13:53:19 mybox sshd(pam_unix)[7186]: authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.0.0.1 user=user May 31 13:53:20 mybox sshd[7186]: pam_krb5: TGT verification failed for `user' May 31 13:53:20 mybox sshd[7186]: pam_krb5: authentication fails for `user' Other accounts, like my own, are fine: May 31 17:25:30 mybox sshd(pam_unix)[12913]: authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.0.0.1 user=myuser May 31 17:25:31 mybox sshd[12913]: pam_krb5: TGT for myuser successfully verified May 31 17:25:31 mybox sshd[12913]: pam_krb5: authentication succeeds for `myuser' May 31 17:25:31 mybox sshd(pam_unix)[12915]: session opened for user myuser by (uid=0) As you can see, TGT validation fails. This only happens for this specific account, not for any other. The failing useraccount's password has been reset, I inspected both user objects in Active Directory, but I see nothing out of the ordinary. If I have the failing useraccount log into a RHEL4 or 5 box, there is not problem, so it must be RHEL3 specific, but the fact that only one account suffers from this, alludes me. Maybe someone has seen this before?

    Read the article

  • Is backing up a MySQL database in GIT a good idea?

    - by wobbily_col
    I am trying to improve the backup situation for my application. I have a Django application and MySQL database. I read an article suggesting backing up the database in Git. On the one hand I like it, as it will keep a copy of the data and the code in synch. But GIT is a designed for code, not for data. As such it will be doing a lot of extra work diffing the mysql dump every commit, which is not really necessary. If I compress the file before storing it, will git diff the files? (The dump file is currently 100MB uncompressed, 5.7Mb when bzipped). Edit: the code and database schema definitions are already in GIT, it is really the data I am concerned about backing up now.

    Read the article

  • .NET 4 RTM MetadataType attribute ignored when using Validator

    - by bart
    I am using VS 2010 RTM and trying to perform some basic validation on a simple type using MetadataTypeAttribute. When I put the validation attribute on the main class, everything works. However, when I put it on the metadata class, it seems to be ignored. I must be missing something trivial, but I've been stuck on this for a while now. I had a look at the Enterprise Library validation block as a workaround, but it doesn't support validation of single properties out of the box. Any ideas? class Program { static void Main(string[] args) { Stuff t = new Stuff(); try { Validator.ValidateProperty(t.X, new ValidationContext(t, null, null) { MemberName = "X" }); Console.WriteLine("Failed!"); } catch (ValidationException) { Console.WriteLine("Succeeded!"); } } } [MetadataType(typeof(StuffMetadata))] public class Stuff { //[Required] //works here public string X { get; set; } } public class StuffMetadata { [Required] //no effect here public string X { get; set; } }

    Read the article

  • Java/Spring: Why won't Spring use the validator object I have configured?

    - by GMK
    I'm writing a web app with Java & Spring 2.5.6 and using annotations for bean validation. I can get the basic annotation validation working fine, and Spring will even call a custom Validator declared with @Validator on the target bean. But it always instantiates a brand new Validator object to do it. This is bad because the new validator has none of the injected dependencies it needs to run, and so it throws a null pointer exception on validate. I need one of two things and I don't know how to do either. Convince Spring to use the validator I have already configured. Convince Spring to honor the @Autowired annotations when it creates the new validator. The validator has the @Component annotation, like this. @Component public class AccessCodeBeanValidator implements Validator { @Autowired private MessageSource messageSource; Spring finds the validator in the component scan, injects the autowired dependencies, but then ignores it and creates a new one at validation time. The only thing that I can do at the moment is add a validator reference into the controller for each validator object and use that ref directly, instead of relying on the bean validation framework to call the validator for me. It looks like this. // first validate via the annotations on the bean beanValidator.validate(accessCodeBean, result); // then validate using the specific validator class acbValidator.validate(accessCodeBean, result); if (result.hasErrors()) { If anyone knows how to convince spring to use the existing validator, instead of creating a new one, or how to make it do the autowiring when it creates a new one, I'd love to know.

    Read the article

  • Making one of a group of similar form fields required in CakePHP

    - by Pickledegg
    I have a bunch of name/email fields in my form like this: data[Friend][0][name] data[Friend][1][name] data[Friend][2][name] etc. and data[Friend][0][email] data[Friend][1][email] data[Friend][2][email] etc. I have a custom validation rule on each one that checks to see if the corresponding field is filled in. Ie. if data[Friend][2][name] then data[Friend][2][email] MUST be filled in. FYI, heres what one of the two rules look like: My form validation rule: ( I have an email validation too but that's irrelevant here) 'name' => array( 'checkEmail' => array( 'rule' => 'hasEmail', 'message' => 'You must fill in the name field', 'last' => true ) ) My custom rule code: function hasEmail($data){ $name = array_values($data); $name = $name[0]; if(strlen($name) == 0){ return empty($this->data['Friend']['email']); } return true; } I need to make it so that one of the pairs should be filled in as a minimum. It can be any as long as the indexes correspond. I can't figure a way, as if I set the form rule to be required or allowEmpty false, it fails on ALL empty fields. How can I check for the existence of 1 pair and if present, carry on? Also, I need to strip out all of the remaining empty [Friend] fields, so my saveAll() doesn't save a load of empty rows, but I think I can handle that part using extract in my controller. The main problem is this validation. Thanks.

    Read the article

  • C# ErrorProvider Want to know if any are Active

    - by RcK
    I want to know if any ErrorProvider are active in my form. being able to find this out might help reduce my code.. I did find this thing here Counting ErrorProvider but incase someone knows a better way... so here goes. Ok so basically I have a WinForm which has many TextBoxes Now when user enters values I use Validating to perform validation and if it does not match Regex I set the ErrorProvider ON for that Control.. similarly if the user changes the value to a acceptable one I switch ErrorProvider OFF for that Control.. but when SAVE is clicked i have to do another check anyways incase the user did not listen to me and change the thing like he was supposed to and still clicked SAVE.. I dont want the thing crashing.. soo mm is there like a thing where I could say if ErrorProviders is not active then proceed with save else message box saying change it. [ANOTHER QUESTION] Umm When Validating it only Validates when the Control loses Focus... I kinda of want it to do validation when user stops typing.. I hope you get what I mean Like Email Address(textbox) when user is typing his/her name in I [DON'T] want it to do validation yet, but when user has finished entering is waiting for ErrorProvider to disappear(But it doesn't coz it only does that when control loses focus) 2 odd seconds after typing can i make the validation take place?

    Read the article

  • Custom Model Validator for MVC

    - by scottrakes
    I am trying to add a custom model validation at the property level but need to pass in two values. Below is my class definition and validation implementation. When it runs, the "value" in the IsValid method is always null. I can get this working at the class level but the property level is causing me issues. What am I missing? Event Class: public class Event { public int? EventID {get;set;} [ValidPURL("EventID", "PURLValue")] public string PURLValue { get; set; } ... } Validation Class [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)] public sealed class ValidPURL : ValidationAttribute { private const string _defaultErrorMessage = "Web address already exist."; private readonly object _typeId = new object(); public ValidPURL(int eventID, string purlValue) : base(_defaultErrorMessage) { EventID = eventID; PURLValue = purlValue; } public int EventID { get; private set; } public string PURLValue { get; private set; } public override object TypeId { get { return _typeId; } } public override string FormatErrorMessage(string name) { return String.Format(CultureInfo.CurrentUICulture, ErrorMessageString, EventID, PURLValue); } public override bool IsValid(object value) { PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value); object eventIDValue = properties.Find(EventID, true /* ignoreCase */).GetValue(value); object purlValue = properties.Find(PURLValue, true /* ignoreCase */).GetValue(value); [Some Validation Logic against the database] return true; } } Thank for the help!

    Read the article

  • Is there any way to access codeigniter language and config properties from included javascript files

    - by ubermensch
    Good morning! I'm having great success so far with CodeIgniter. I'm new to PHP and web development in general, but I feel that CodeIgniter is giving me a leg up while I catch up on the basics. My question for today is this - I have been happily loading config and lang values from my views for a while now, and everything is working fine. But what about JavaScript files being linked into my views? Is there any way to make the $this-lang-line and $this-config-item function references available to me in my JavaScript files? I am implementing jQuery client-side validation, and would like to pull in my error messages from the server, both to support internationalisation and to make sure that validation gracefully degrades if JavaScript is not available, in that the error messages pushed back into the view from the server-side validation are identical to those displayed dynamically by the jQuery validation. I would not like to have to keep coming back to make sure that these strings are kept in sync. As for internationalisation, I'm fresh out of ideas on how to support that if it turns out that lang and config item strings are completely unavailable from my JS files. Any help you can provide would be greatly appreciated! :)

    Read the article

  • py.test import context problems (causes Django unit test failure)

    - by dhill
    I made a following test: # main.py import imported print imported.f.__module__ # imported.py def f(): pass # test_imported.py (py.test test case) import imported def test_imported(): result = imported.f.__module__ assert result == 'imported' Running python main.py, gives me imported, but running py.test gives me error and result value is moduletest.imported (moduletest is the name of the directory I keep the test in. It doesn't contain __init__.py, moduletest is the only directory containing *.py files in ~/tmp). How can I fix result value? The long story: I'm getting strange errors, while testing Django application. A call to reverse() from (django.urlresolvers). with function object foo as argument in tests crashes with NoReverseMatch: Reverse for 'site.app.views.foo'. The same call inside application works. I checked and it is converted to 'app.views.foo' (without site prefix). I first suspected my customised test setup for Django, but then I made above test.

    Read the article

  • Windows + Django + mod_wsgi = "DLL load failed"

    - by Kyle MacFarlane
    For a long time I was using Python 2.5 to do all this fine but recently upgraded to 2.7 since building stuff for 2.5 is a real pain. I also updated mod_wsgi to 3.3 for Python 2.7. Everything is working fine with Apache + mod_wsgi on CentOS and also in the Django runserver on both Windows and CentOS, but not with Apache + mod_wsgi on Windows. Whenever I try to access a page in my Django app I get the following (note that Apache starts fine): ImportError at / DLL load failed: The specified module could not be found. Which is caused by things like: from Crypto.Cipher import AES Etree and others cause the exact same error and it is not limited to any specific packages. Anything with pyd files fails. Googling around suggests reinstalling Python "for all users", but the installer doesn't give you that option anymore anyway. For good measure I've tried reinstalling Python 2.7 as an administrator and also told it to register itself as the default version of Python but neither helped. I think the solution might have something to do with: The fact that I have 2.5, 2.6 and 2.7 installed on this machine and mod_wsgi might be loading the DLLs for 2.5 instead of 2.7. Something to do with WSGIPythonPath, which I usually don't need to set.

    Read the article

  • Side effect of calling ValidatorEnable method: sets focus to control associated with validator

    - by Velika2
    When I called this function to enable a validator from client javascript: `ValidatorEnable(document.getElementById('<%=valPassportOtherText.ClientID%>'), true); //enable` validation control The side effect was that focus was shifted to the txtSpecifyOccupation textbox (the control associated with the Validation control) <asp:TextBox ID="txtSpecifyOccupation" runat="server" AutoCompleteType="Disabled" CssClass="DefaultTextBox DefaultWidth" MaxLength="24" Rows="2"></asp:TextBox> <asp:RequiredFieldValidator ID="valSpecifyOccupation" runat="server" ControlToValidate="txtSpecifyOccupation" ErrorMessage="1.14b Please specify your &lt;b&gt;Occupation&lt;/b&gt;" SetFocusOnError="True">&nbsp;Required</asp:RequiredFieldValidator> Perhaps there is a way to enable the (required) validator without having it simultaneously perform the validation (at least until the user has tabbed off of it?)

    Read the article

  • How can I use a custom ValidationAttribute to ensure two properties match?

    - by Brandon Linton
    We're using xVal and the standard DataAnnotationsValidationRunner described here to collect validation errors from our domain objects and view models in ASP.NET MVC. I'd like to have a way to have that validation runner identify when two properties don't match through the use of custom DataAnnotations. Right now I'm forced into doing it outside of the runner, this way: if (!(model.FieldOne == model.FieldTwo)) errors.Add(new ErrorInfo("FieldTwo", "FieldOne must match FieldTwo", model.FieldTwo)); My question is: can this be done using property-level validation attributes, or am I forced into using class-level attributes (in which case, I'd have to modify the runner...and my follow up question would be how best to retrieve them in that case). Thanks!

    Read the article

  • Why "alt" attribute for <img> tag has been considered mandatory by the HTML validator .. ?

    - by infant programmer
    Is there any logical or technical reason (with the W3C validation) for making alt as required attribute .. This is my actual problem:though my page is perfect enough with respect to W3C validation rules .. Only error I am getting is line XX column YY - Error: required attribute "ALT" not specified I know the significance of "alt" attribute and I have omitted that where it is unnecessary .. (to be more elaborate .. I have added the image to increase the beauty of my page and I don't want alt attribute to show irrelevant message to the viewer) getting rid of the error is secondary .. rather I am curious to know whether is it a flaw with validation rules .. ?? I thank stackOverflow and all the members who responded me .. I got my doubt clarified .. :-)

    Read the article

  • Where and how to validate and map ViewModel?

    - by chobo
    Hi, I am trying to learn Domain Driven Design and recently read that lots of people advocate creating a ViewModels for your views that store all the values you want to display in a given view. My question is how should I do the form validation? should I create separate validation classes for each view, or group them together? I'm also confused on what this would look like in code. This is how I currently think validation and viewmodels fit in to the scheme of things: View (some user input) - Controller - FormValidation(of ViewModel) - (If valid map to ViewModel to Domain Model) - Domain Layer Service - Infrastructure Thanks! P.S. I use Asp.net MVC with C#

    Read the article

  • Do any browsers yet support HTML5's checkValidity() method?

    - by James A. Rosen
    The HTML5 spec defines some very interesting validation components, including pattern (for validating against a Regexp) and required (for marking a field as required). As best I can tell, however, no browser yet actually does any validation based on these attributes. I found a comparison of HTML5 support across engines, but there is no information about validation there. In the browsers I've tried (Firefox 3.5.8 and Safari 4.0.4), no object has a checkValidity() method, so I can't run the validations even though I can define them. Is there any support for this feature out there so I can experiment?

    Read the article

  • Custom Validator and specifying type of message

    - by user102533
    I have a custom validation in the enterprise validation block. The DoValidate method is as shown below. protected override void DoValidate(Double objectToValidate, object currentTarget, string key, ValidationResults validationResults) { if (!IsSalMoreThanMinWage(objectToValidate)) { //Here I need to mark this message as a "Warning" LogValidationResult(validationResults, "Salary is too low for this state", currentTarget, key); } } I'd need to mark this validation failure as a "warning" message. In the front end, when I iterate through the ValidationResults collection and grab a ValidationResult object, I would need to identify and group different types of messages and render them differently. My question is - how do I mark a failure as a warning?

    Read the article

< Previous Page | 129 130 131 132 133 134 135 136 137 138 139 140  | Next Page >