Search Results

Search found 5309 results on 213 pages for 'w3c validation'.

Page 31/213 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Extended validation certificate not changing browser bar green in Firefox

    - by Max
    I'm having some problems with an Extended validation certificate on a site that isn't showing the green bar correctly in Firefox. Chrome and IE are working fine. When I load the page the bar appears for a few seconds and then disappears when the page has fully loaded. Someone mentioned it could be because of loading images over HTTPS, but I'm not sure how valid this case is. We have one image on the page that is loaded from another source over HTTPS, the rest of the images are stored in the file system on the server. FYI - its Windows Server 2008 and ASP.net UPDATE: Solved this problem - the style sheet was loading in a Google Font url using http, not https - changed it and now it's working.

    Read the article

  • [News] Validation des d?pendances inter-couches

    Visual Studio 2010 propose une fonctionnalit? r?ellement pertinente, notamment lorsqu'on r?alise de l'audit de code. La validation des couches d'architecture permet de d?celer des probl?mes de d?pendances invalides entre les couches d'une architecture. Ceci peut arriver lorsque la couche de pr?sentation court-circuite la couche de services pour acc?der ? des DAO. Coupl? avec TFS, il est m?me possible d'interdire le commit d'une d?pendance invalide. A d?couvrir absolument.

    Read the article

  • Le W3C publie un premier brouillon de l'API Push, qui permettra d'intégrer des notifications Push au sein des applications Web

    Le W3C publie un premier brouillon de l'API Push qui permettra d'intégrer des notifications Push au sein des applications Web Le groupe de travail Web Applications du W3C (World Wide Web Consortium) vient de publier un brouillon pour l'API Push. La spécification Push API décrit la façon dont un serveur d'applications peut envoyer des données cryptées (messages Push) à des applications Web côté client, telles qu'elles sont effectuées par des « services Push ». L'API pourra être utilisée par les développeurs pour mettre en oeuvre des systèmes de notifications Push au sein de leurs Webapps. Selon la description du W3C, le message Push pourra être envoyé même si l'applic...

    Read the article

  • Design Pattern for Data Validation

    - by melodui
    What would be the best design pattern for this problem: I have an Object A. Object A can either be registered or deleted from the database depending on the user request. Data validation is performed before registration or deletion of the object. There are a set of rules to be checked before the object can be registered and another set of rules for deletion. Some of these rules are common for both operations. So far, I think the Chain of Responsibility design pattern fits the most but I'm having trouble implementing it.

    Read the article

  • Email Validation... advocating the use of +, and how embarrassed would you be to have written this?

    - by Langdon
    I take full advantage of GMail's wildcard feature ([email protected]). Unfortunately it seems that most developers don't understand that + is valid in an email address. This makes trying to unsubscribe a real chore sometimes. Take TicketMaster for example... immediately you notice that they didn't even bother escaping the email address, so the text field defaults to "user [email protected]". Not a problem, we can just add the + manually. Once Submit is clicked, you'll notice the validation stops you right in your tracks. What now? Most users would have to further contact TicketMaster and attempt to explain the situation. I opened up FireBug to investigate. That's when I noticed this whopping 74 line email validation function with so much redundancy it's ridiculous. My favorite check is on line 20, informing the user that his/her email cannot have more than one @. Unreal. My second favorite part is the TWO regular expressions used! Imagine... someone was paid money for this... and by the looks of it, they were paid by the line count. //Validates the email function validateOptoutEmail(object) { var emailStr = object.value; if(emailStr == '' || emailStr == null) { alert('Email can not be empty. Please provide email'); object.value = ''; object.focus(); return false; } else if(Trim(emailStr).length == 0) { alert('Email can not be empty. Please provide email'); object.value = ''; object.focus(); return false; } else { var atcount=0; for(var i=0;i<emailStr.length;i++) { if(emailStr.charAt(i)=='@') atcount++; } if(atcount>1) { alert('Invalid email. Email cannot have more than one @'); object.value = ''; object.focus(); return false; } if(emailStr.indexOf('.') == -1) { alert('Invalid email. Email must have one dot'); object.value = ''; object.focus(); return false; } if(emailStr.indexOf('..')!= -1) { alert('Invalid email. Email cannot have consecutive dots'); object.value = ''; object.focus(); return false; } var dotpos=0; for(var i=dotpos;i< emailStr.length;i++) { var ichar=emailStr.charAt(i); if(ichar=='.') dotpos=i; } for(var i=dotpos+1;i< emailStr.length;i++) { var ichar=emailStr.charAt(i); if((!isNaN(ichar)) || (ichar == '_')) { alert('Invalid email. Email cannot have numbers or _ after dot'); object.value = ''; object.focus(); return false; } } var pattern2=/^([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/; var pattern1=/^[0-9a-zA-Z\-\_.]+@\w+([\.-]?\w+)*(\.\w{2,4})+$/; if (pattern1.test(emailStr)) { if(pattern2.test(emailStr)) { return true; } else { alert('Invalid email'); object.value = ''; object.focus(); } return true; } else { alert('Invalid email'); object.value = ''; object.focus(); return false; } alert('Invalid email'); object.value = ''; object.focus(); return false; } } I eventually just put a break point in FireBug and changed the value of the email address passed into the validation function. From there everything worked fine... All that said, how can we get the word out there that + is valid in an email address? Too often, I'm unable to use the email address that I want to use for certain web sites because developers simply aren't aware of what constitutes a valid email address.

    Read the article

  • MVC.net 2 - change the HTML outputed by ValidationMessageFor - can this be down via templates?

    - by Nathan Kelly
    MVC.net 2 by default outputs validation messages like this: <span id="UserName_validationMessage" class="field-validation-valid">A Validation message</span> I would like it to do it like this: <label id="UserName_validationMessage" class="field-validation-valid">A Validation message</label> Is there a way to do it like the display and editor templates? Or is there another way to do it globally?

    Read the article

  • If the model is validating the data, shouldn't it throw exceptions on bad input?

    - by Carlos Campderrós
    Reading this SO question it seems that throwing exceptions for validating user input is frowned upon. But who should validate this data? In my applications, all validations are done in the business layer, because only the class itself really knows which values are valid for each one of its properties. If I were to copy the rules for validating a property to the controller, it is possible that the validation rules change and now there are two places where the modification should be made. Is my premise that validation should be done on the business layer wrong? What I do So my code usually ends up like this: <?php class Person { private $name; private $age; public function setName($n) { $n = trim($n); if (mb_strlen($n) == 0) { throw new ValidationException("Name cannot be empty"); } $this->name = $n; } public function setAge($a) { if (!is_int($a)) { if (!ctype_digit(trim($a))) { throw new ValidationException("Age $a is not valid"); } $a = (int)$a; } if ($a < 0 || $a > 150) { throw new ValidationException("Age $a is out of bounds"); } $this->age = $a; } // other getters, setters and methods } In the controller, I just pass the input data to the model, and catch thrown exceptions to show the error(s) to the user: <?php $person = new Person(); $errors = array(); // global try for all exceptions other than ValidationException try { // validation and process (if everything ok) try { $person->setAge($_POST['age']); } catch (ValidationException $e) { $errors['age'] = $e->getMessage(); } try { $person->setName($_POST['name']); } catch (ValidationException $e) { $errors['name'] = $e->getMessage(); } ... } catch (Exception $e) { // log the error, send 500 internal server error to the client // and finish the request } if (count($errors) == 0) { // process } else { showErrorsToUser($errors); } Is this a bad methodology? Alternate method Should maybe I create methods for isValidAge($a) that return true/false and then call them from the controller? <?php class Person { private $name; private $age; public function setName($n) { $n = trim($n); if ($this->isValidName($n)) { $this->name = $n; } else { throw new Exception("Invalid name"); } } public function setAge($a) { if ($this->isValidAge($a)) { $this->age = $a; } else { throw new Exception("Invalid age"); } } public function isValidName($n) { $n = trim($n); if (mb_strlen($n) == 0) { return false; } return true; } public function isValidAge($a) { if (!is_int($a)) { if (!ctype_digit(trim($a))) { return false; } $a = (int)$a; } if ($a < 0 || $a > 150) { return false; } return true; } // other getters, setters and methods } And the controller will be basically the same, just instead of try/catch there are now if/else: <?php $person = new Person(); $errors = array(); if ($person->isValidAge($age)) { $person->setAge($age); } catch (Exception $e) { $errors['age'] = "Invalid age"; } if ($person->isValidName($name)) { $person->setName($name); } catch (Exception $e) { $errors['name'] = "Invalid name"; } ... if (count($errors) == 0) { // process } else { showErrorsToUser($errors); } So, what should I do? I'm pretty happy with my original method, and my colleagues to whom I have showed it in general have liked it. Despite this, should I change to the alternate method? Or am I doing this terribly wrong and I should look for another way?

    Read the article

  • Asp.Net MVC Data Annotations. How to get client side validation on 2 properties being equal

    - by Mark
    How do you get client side validation on two properties such as the classic password confirm password scenario. I'm using a metadata class based on EF mapping to my DB table, heres the code. The commented out attributes on my class will get me server side validation but not client side. [MetadataType(typeof(MemberMD))] public partial class Member { //[CustomValidation(typeof(MemberMD), "Verify", ErrorMessage = "The password and confirmation password did not match.")] //[PropertiesMustMatch("Password", "ConfirmPassword", ErrorMessage = "The password and confirmation password did not match.")] public class MemberMD { [Required(ErrorMessage = "Name is required.")] [StringLength(50, ErrorMessage = "No more than 50 characters")] public object Name { get; set; } [Required(ErrorMessage = "Email is required.")] [StringLength(50, ErrorMessage = "No more than 50 characters.")] [RegularExpression(".+\\@.+\\..+", ErrorMessage = "Valid email required e.g. [email protected]")] public object Email { get; set; } [Required(ErrorMessage = "Password is required.")] [StringLength(30, ErrorMessage = "No more than 30 characters.")] [RegularExpression("[\\S]{6,}", ErrorMessage = "Must be at least 6 characters.")] public object Password { get; set; } [Required] public object ConfirmPassword { get; set; } [Range(0, 150), Required] public object Age { get; set; } [Required(ErrorMessage = "Postcode is required.")] [RegularExpression(@"^[a-zA-Z0-9 ]{1,10}$", ErrorMessage = "Postcode must be alphanumeric and no more than 10 characters in length")] public object Postcode { get; set; } [DisplayName("Security Question")] [Required] public object SecurityQuestion { get; set; } [DisplayName("Security Answer")] [Required] [StringLength(50, ErrorMessage = "No more than 50 characters.")] public object SecurityAnswer { get; set; } public static ValidationResult Verify(MemberMD t) { if (t.Password == t.ConfirmPassword) return ValidationResult.Success; else return new ValidationResult(""); } } Any help would be greatly appreciated, as I have only been doing this 5 months please try not to blow my mind.

    Read the article

  • JQuery validate: How to add a rule for regular expression validation?

    - by PeterTheNiceGuy
    I am new to JQuery and am using the JQuery validation plugin. Great stuff! I want to migrate my existing ASP.NET solution to use JQuery instead of the ASP.NET validators. I am missing a replacement for the regular expression validator. I want to be able to do something like this: $("Textbox").rules("add", { regularExpression: "^[a-zA-Z'.\s]{1,40}$" }) Could anyone give me a hint how to add a custom rule to achieve this?

    Read the article

  • How to print a specific actionerror message with Struts2 validation?

    - by FarmBoy
    When using Struts2 validation, when you put the <s:actionerror> tag in your JSP, the default behavior is to display all the action errors at that point in the page. Is there a way to display only specific error messages at that point? For example, in the case of fielderror one only needs to add the fieldName attribute. Is there an attribute of actionerror that accomplishes similar behavior?

    Read the article

  • how can i overriding the inbound message validation with cxf?

    - by user1648330
    when i input a non-numeric content to a Integer types of field, i have got a fault mesasge 'Not a number: 0.012A'. How to do ability to in prior to the Unmarshal for schema validation and output custom error messages? I used cxf 2.6.1 and also configuration with <entry key="schema-validation-enabled" value="true" ></entry> in cxf-spring.xml. java.lang.RuntimeException: Not a number: 0.012A at com.jiemai.jmservice.handlers.ValidationEventHandler.handleEvent(ValidationEventHandler.java:19) at org.apache.cxf.jaxb.io.DataReaderImpl$WSUIDValidationHandler.handleEvent(DataReaderImpl.java:78) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:655) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:691) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:687) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleParseConversionException(Loader.java:271) at com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.java:69) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:514) at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.text(InterningXmlVisitor.java:93) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.processText(StAXStreamConnector.java:338) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleEndElement(StAXStreamConnector.java:216) at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:185) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:370) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:349) at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:784) at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:97) at org.apache.cxf.jaxb.JAXBEncoderDecoder$1.run(JAXBEncoderDecoder.java:812) at java.security.AccessController.doPrivileged(Native Method) at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:810) at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:644) at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:157) at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:108) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:110) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source)

    Read the article

  • Does anyone know if WordPress has builtin PHP validation functions?

    - by racl101
    Hi everyone, I am trying to build a form in WordPress and taking advantage of all its built-in functions but I am hard pressed to find any functions that do form validation. I figure those kinds of functions have to exist in WordPress but I couldn't find any because its documentation is sparse and spread out in some respects. Would anyone have any useful links to documentation and tutorials by any chance?

    Read the article

  • (PHP) Validation, Security and Speed - Does my app have these?

    - by Devner
    Hi all, I am currently working on a building community website in PHP. This contains forms that a user can fill right from registration to lot of other functionality. I am not an Object-oriented guy, so I am using functions most of the time to handle my application. I know I have to learn OOPS, but currently need to develop this website and get it running soon. Anyway, here's a sample of what I let my app. do: Consider a page (register.php) that has a form where a user has 3 fields to fill up, say: First Name, Last Name and Email. Upon submission of this form, I want to validate the form and show the corresponding errors to the users: <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="name">Name:</label> <input type="text" name="name" id="name" /><br /> <label for="lname">Last Name:</label> <input type="text" name="lname" id="lname" /><br /> <label for="email">Email:</label> <input type="text" name="email" id="email" /><br /> <input type="submit" name="submit" id="submit" value="Submit" /> </form> This form will POST the info to the same page. So here's the code that will process the POST'ed info: <?php require("functions.php"); if( isset($_POST['submit']) ) { $errors = fn_register(); if( count($errors) ) { //Show error messages } else { //Send welcome mail to the user or do database stuff... } } ?> <?php //functions.php page: function sql_quote( $value ) { if( get_magic_quotes_gpc() ) { $value = stripslashes( $value ); } else { $value = addslashes( $value ); } if( function_exists( "mysql_real_escape_string" ) ) { $value = mysql_real_escape_string( $value ); } return $value; } function clean($str) { $str = strip_tags($str, '<br>,<br />'); $str = trim($str); $str = sql_quote($str); return $str; } foreach ($_POST as &$value) { if (!is_array($value)) { $value = clean($value); } else { clean($value); } } foreach ($_GET as &$value) { if (!is_array($value)) { $value = clean($value); } else { clean($value); } } function validate_name( $fld, $min, $max, $rule, $label ) { if( $rule == 'required' ) { if ( trim($fld) == '' ) { $str = "$label: Cannot be left blank."; return $str; } } if ( isset($fld) && trim($fld) != '' ) { if ( isset($fld) && $fld != '' && !preg_match("/^[a-zA-Z\ ]+$/", $fld)) { $str = "$label: Invalid characters used! Only Lowercase, Uppercase alphabets and Spaces are allowed"; } else if ( strlen($fld) < $min or strlen($fld) > $max ) { $curr_char = strlen($fld); $str = "$label: Must be atleast $min character &amp; less than $max char. Entered characters: $curr_char"; } else { $str = 0; } } else { $str = 0; } return $str; } function validate_email( $fld, $min, $max, $rule, $label ) { if( $rule == 'required' ) { if ( trim($fld) == '' ) { $str = "$label: Cannot be left blank."; return $str; } } if ( isset($fld) && trim($fld) != '' ) { if ( !eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $fld) ) { $str = "$label: Invalid format. Please check."; } else if ( strlen($fld) < $min or strlen($fld) > $max ) { $curr_char = strlen($fld); $str = "$label: Must be atleast $min character &amp; less than $max char. Entered characters: $curr_char"; } else { $str = 0; } } else { $str = 0; } return $str; } function val_rules( $str, $val_type, $rule='required' ){ switch ($val_type) { case 'name': $val = validate_name( $str, 3, 20, $rule, 'First Name'); break; case 'lname': $val = validate_name( $str, 10, 20, $rule, 'Last Name'); break; case 'email': $val = validate_email( $str, 10, 60, $rule, 'Email'); break; } return $val; } function fn_register() { $errors = array(); $val_name = val_rules( $_POST['name'], 'name' ); $val_lname = val_rules( $_POST['lname'], 'lname', 'optional' ); $val_email = val_rules( $_POST['email'], 'email' ); if ( $val_name != '0' ) { $errors['name'] = $val_name; } if ( $val_lname != '0' ) { $errors['lname'] = $val_lname; } if ( $val_email != '0' ) { $errors['email'] = $val_email; } return $errors; } //END of functions.php page ?> OK, now it might look like there's a lot, but lemme break it down target wise: 1. I wanted the foreach ($_POST as &$value) and foreach ($_GET as &$value) loops to loop through the received info from the user submission and strip/remove all malicious input. I am calling a function called clean on the input first to achieve the objective as stated above. This function will process each of the input, whether individual field values or even arrays and allow only tags and remove everything else. The rest of it is obvious. Once this happens, the new/cleaned values will be processed by the fn_register() function and based on the values returned after the validation, we get the corresponding errors or NULL values (as applicable). So here's my questions: 1. This pretty much makes me feel secure as I am forcing the user to correct malicious data and won't process the final data unless the errors are corrected. Am I correct? Does the method that I follow guarantee the speed (as I am using lots of functions and their corresponding calls)? The fields of a form differ and the minimum number of fields I may have at any given point of time in any form may be 3 and can go upto as high as 100 (or even more, I am not sure as the website is still being developed). Will having 100's of fields and their validation in the above way, reduce the speed of application (say upto half a million users are accessing the website at the same time?). What can I do to improve the speed and reduce function calls (if possible)? 3, Can I do something to improve the current ways of validation? I am holding off object oriented approach and using FILTERS in PHP for the later. So please, I request you all to suggest me way to improve/tweak the current ways and suggest me if the script is vulnerable or safe enough to be used in a Live production environment. If not, what I can do to be able to use it live? Thank you all in advance.

    Read the article

  • An AuthLogic form is giving me incorrect validation errors -- why?

    - by sscirrus
    Hi everyone, I set up AuthLogic for Rails according to the AuthLogic example: http://github.com/binarylogic/authlogic_example. I can log on successfully to the system, but when accessing users/new.html.erb to register a new user, the form returns the following validation errors: Email is too short (minimum is 6 characters) Email should look like an email address. Login is too short (minimum is 3 characters) Login should use only letters, numbers, spaces, and .-_@ please. Password is too short (minimum is 4 characters) Password confirmation is too short (minimum is 4 characters) None of these errors exist in the data I am entering. # new.html.erb <%= form.label :login, nil, :class => "label" %><br /> <%= form.text_field :login, :class => "inputBox", :name => "login", :type => "text" %><br /> <%= form.label :password, form.object.new_record? ? nil : "Change password", :class => "label" %><br /> <%= form.password_field :password, :class => "inputBox", :name => "password", :type => "text" %><br /> <%= form.label "Confirm password", nil, :class => "label" %><br /> <%= form.password_field :password_confirmation, :class => "inputBox", :name => "password_confirmation", :type => "text" %><br /> <%= form.label :email, nil, :class => "label" %><br /> <%= form.text_field :email, :class => "inputBox", :name => "email", :type => "text" %><br /> # Users controller def new @user = User.new render :layout => "forms" end I think the problem is that the data isn't being transferred somehow and therefore AuthLogic doesn't think the inputs are sufficient. Do you have any idea why AuthLogic is telling me the data doesn't satisfy its validation?

    Read the article

  • Does the type in this KVC validation method matter?

    - by dontWatchMyProfile
    For example, in the docs a KVC-style validation method is implemented like this: -(BOOL)validateAge:(id *)ioValue error:(NSError **)outError They used id* as the type for ioValue. Since that's not part of the method signature, I wonder if it would hurt to do something like: -(BOOL)validateAge:(NSNumber *)ioValue error:(NSError **)outError Is this still fine with KVC?

    Read the article

  • ssh-rsa public key validation using a regular expression.

    - by Warlax
    What regular expression can I use (if any) to validate that a given string is a legal ssh rsa public key? I only need to validate the actual key - I don't care about the key type the precedes it or the username comment after it. Ideally, someone will also provide the python code to run the regex validation. Thanks.

    Read the article

  • Retain a list of objects and pass it to the create/edit view when validation fails in ASP.NET MVC 2

    - by brainnovative
    I am binding a Foreign key property in my model. I am passing a list of possible values for that property in my model. The model looks something like this: public class UserModel { public bool Email { get; set; } public bool Name { get; set; } public RoleModel Role { get; set; } public IList<RoleModel> Roles { get; set; } } public class RoleModel { public string RoleName { get; set; } } This is what I have in the controller: public ActionResult Create() { IList<RoleModel> roles = RoleModel.FromArray(_userService.GetAllRoles()); UserModel model = new UserModel() { Roles = roles }; return View(model); } In the view I have: <div class="editor-label"> <%= Html.LabelFor(model => model.Role) %> </div> <div class="editor-field"> <%= Html.DropDownListFor(model => model.Role, new SelectList(Model.Roles, "RoleName", "RoleName", Model.Role))%> <%= Html.ValidationMessageFor(model => model.Role)%> </div> What do I need to do to get the list of roles back to my controller to pass it again to the view when validation fails. This is what I need: [HttpPost] public ActionResult Create(UserModel model) { if (ModelState.IsValid) { // insert logic here } //the validation fails so I pass the model again to the view for user to update data but model.Roles is null :( return View(model); } As written in the comments above I need to pass the model with the list of roles again to my view but model.Roles is null. Currently I ask the service again for the roles (model.Roles = RoleModel.FromArray(_userService.GetAllRoles());) but I don't want to add an extra overhead of getting the list from DB when I have already done that.. Anyone knows how to do it?

    Read the article

  • Rails 3: How not to include column's name in a validation message without plugins ?

    - by Misha Moroshko
    I have the following validation: validates_presence_of :price, :message => "my message" and I get the following error when the price is blank: Price my message Is there a way not to include the column name (price) in the message ? I tried to do: validates_presence_of :price, :message => "^ my message" as suggested here, but it didn't work for me. I got the following message: Price ^ my message

    Read the article

  • Mobile Safari Geolocation API Issues

    - by sph
    Hi, since Mobile Safari's Geolocation API should be an implementation of the W3C Geolocation API I found some bugs. I was wondering if anybody noticed the same. As specified in the W3C Geolocation API the PositionCallback returns a Position object, which contains a Coordinates object. In this object all attributes are of type double. Using navigator.geolocation.getCurrentPosition and checking the Position object in the successCallback the accuracy attribute is always an object, but should be a double. The heading attribute is always -1 when testing in the iPhone simulator, but should be null or between 0 and 360. 2. Setting the options parameter for navigator.geolocation.watchPosition or navigator.geolocation.getCurrentPosition as specified in the W3C Geolocation API has no effect. No matter what is set as the timeout value, the win callback is called every 10 seconds. For example setting the timeout=1000 should immediately call either the successCallback or errorCallback. Thanks

    Read the article

  • Choosing a W3C valid DOCTYPE and charset combination?

    - by George Carter
    I have a homepage with the following: <DOCTYPE html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> My choice of the DOCTYPE "html" is based on a recommendation for html pages using jQuery. My choice of charset=utf=8 is based on a recommendation to make my pages readable on most browsers. But these choices may be wrong. When I run this page thru the W3C HTML validator, I get messages you see below. Any way I can eliminate the 2 errors? ! Using experimental feature: HTML5 Conformance Checker. The validator checked your document with an experimental feature: HTML5 Conformance Checker. This feature has been made available for your convenience, but be aware that it may be unreliable, or not perfectly up to date with the latest development of some cutting-edge technologies. If you find any issue with this feature, please report them. Thank you. Validation Output: 2 Errors 1. Error Line 18, Column 70: Changing character encoding utf-8 and reparsing. …ntent-Type" content="text/html; charset=utf-8"> 2. Error Line 18, Column 70: Changing encoding at this point would need non-streamable behavior. …ntent-Type" content="text/html; charset=utf-8">

    Read the article

  • Conflict with @Html.LabelFor and W3C Validator?

    - by Tyler
    I have a model that I am using to present an index of a model from a database and have given a display name to some of the rows that may need spaces in them, (I.e. "weekstarting" in a db would be given a display name of "Week Starting"). So I set the display name for my model like this: [DisplayName("Week Starting")] public DateTime WeekStarting { get; set; } and then in the table headers for my table I use the following line of code to display the field name using its given display name: @Html.LabelFor(x => x.First().WeekStarting) The above all works fine. But I am using the W3C validator and it is giving me the following error for the example I have given: The for attribute of the label element must refer to a form control. Forgive me if it is obvious but what am I doing wrong here? I am not using a form I am simply displaying an index of items in a table. I have tried to look for an answer and saw someone suggest that the form controls being referred to need ids (even though I'm not using a form) but this would not be applicable in this instance because if I tried to set an id in the index it would be duplicated with each item in the index: foreach (var item in Model.Tbms) { <tr><td>@item.value</td><tr>.... would be repeated for each item, and also unsure where I would put the id in any case, the td? } Or is there a better way to label the field header, with my preferred display name in the first place? I guess I could just swap @Html.LabelFor... for Hard code field name but do I have to?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >