Search Results

Search found 6715 results on 269 pages for 'preg match'.

Page 101/269 | < Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >

  • 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

  • Comments in string and strings in comments

    - by Jay Gridley
    Hi there, I am trying to count characters in comments included in C code using Python and Regex, but no success. I can erase strings first to get rid of comments in strings, but this will erase string in comments too and result will be bad ofc. Is there any chance to ask by using regex to not match strings in comments or vice versa?

    Read the article

  • SIFR 3.0 - Font Size

    - by Nick
    I have been working with SIFR 3.0 for some time now and the font-size never seems to work correctly. I understand the most basic concepts behind SIFR. SIFR runs when you load the page. It does some calculations one the size of the HTML rendered font and then replaces it with a flash movie that is roughly equal to that size. Because of this, you want to style your HTML font to match the size of your SIFR font as close as possible. My problem always comes up when trying to style these two font sizes to match. Let's say I want to use a SIFR font of Helvetica Neue Lt at about 32px. The HTML equivalent is something like Arial Narrow at about 36px with some negative letter spacing. So here is what I do. In sifr.css I'll write: @media screen { .sIFR-active h1 { visibility: hidden; z-index: 0 !important; font-size: 36px; } } Great, that gets the default HTML font the size I need. Now I need to update the flash SIFR font size. So I go into sifr-config.js and write something like this: sIFR.replace(HelveticaNeueThinCond, { selector: 'h1', css: '.sIFR-root { color: #762123; font-size: 32px; line-height: 1em; }', transparent: true }); So right now everything is working great. That is until my h1 text wraps more than one line. For some reason, when the text wraps it only shows the first line. It seems calculates the height wrong. This is very weird because I ran some tests. I took "visibility: hidden" off of "sIFR-active h1" to make sure that the HTML rendered text was the right size. It is, it takes up two lines. However, when the Flash replaces this text it gives it a min-height of one line of text. Odd. The only way I could find to fix this wrapping problem was to remove "font-size: 32px;" from "sIFR.replace(HelveticaNeueThinCond" in sifr-config. The problem I run into then is that it inherits the font-size set in sifr.css. Now the problem is that my HTML text is bigger then the SIFR text. So occasional my HTML text will wrap to a new line before my SIFR text leaving a big white space. So, how do I set two different font-size (one for my HTML text and one for my SIFR) without losing the wrapping. The only time I have been able to use the successfully is when I have a SIFR font that is so similar to a web safe font that they can share the same font-size attribute. Thanks

    Read the article

  • Xcode Fails to Launch iPhone Simulator

    - by senfo
    I am attempting to launch the iPhone simulator from Xcode, but I keep getting the following error: Error from Debugger: Failed to launch simulator: Operation failed with underlying error: 4294967253. I've found a number of posts where Xcode failed to launch the simulator, but none of them match the specific error code I'm receiving.

    Read the article

  • TypeInitializeException on MVVM pattern

    - by Mohit Deshpande
    System.TypeInitializationException was unhandled Message=The type initializer for 'SmartHomeworkOrganizer.ViewModels.MainViewModel' threw an exception. Source=SmartHomeworkOrganizer TypeName=SmartHomeworkOrganizer.ViewModels.MainViewModel StackTrace: at SmartHomeworkOrganizer.ViewModels.MainViewModel..ctor() at SmartHomeworkOrganizer.App.OnStartup(Object sender, StartupEventArgs e) in C:\Users\Mohit\Documents\Visual Studio 2010\Projects\SmartHomeworkOrganizer\SmartHomeworkOrganizer\App.xaml.cs:line 21 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at SmartHomeworkOrganizer.App.Main() in C:\Users\Mohit\Documents\Visual Studio 2010\Projects\SmartHomeworkOrganizer\SmartHomeworkOrganizer\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.ArgumentException Message=Default value type does not match type of property 'Score'. Source=WindowsBase StackTrace: at System.Windows.DependencyProperty.ValidateDefaultValueCommon(Object defaultValue, Type propertyType, String propertyName, ValidateValueCallback validateValueCallback, Boolean checkThreadAffinity) at System.Windows.DependencyProperty.ValidateMetadataDefaultValue(PropertyMetadata defaultMetadata, Type propertyType, String propertyName, ValidateValueCallback validateValueCallback) at System.Windows.DependencyProperty.RegisterCommon(String name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback) at System.Windows.DependencyProperty.Register(String name, Type propertyType, Type ownerType, PropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback) at System.Windows.DependencyProperty.Register(String name, Type propertyType, Type ownerType, PropertyMetadata typeMetadata) at SmartHomeworkOrganizer.ViewModels.MainViewModel..cctor() in C:\Users\Mohit\Documents\Visual Studio 2010\Projects\SmartHomeworkOrganizer\SmartHomeworkOrganizer\ViewModels\MainViewModel.cs:line 72 InnerException: This bit of code throws a System.ArgumentException before the TypeInitializeException. It says: "Default value type does not match type of property Score": public static readonly DependencyProperty ScoreProperty = DependencyProperty.Register("Score", typeof(float), typeof(MainViewModel), new UIPropertyMetadata(0.0)); Here is the .NET property: public float Score { get { return (float) GetValue(ScoreProperty); } set { SetValue(ScoreProperty, value); } }

    Read the article

  • Improving lossless codecs [closed]

    - by LarsOn
    Improve the name to match positively Starting just discussing the naming first ignoring tech details, lossless is a negative and double negative word for one good reason should get named more appropriate: Lossless also matches nothing. When naming like all intact or likewise matches something in a manner more physical like sounds are. Then more technically stated that a copy might contain more information than the original. Does method as such have a name, if so what do I refer to, can we name it if you please or just discuss related handling.

    Read the article

  • Install APC on Windows

    - by jiewmeng
    how can i install APC on Windows? i am using PHP 5.3, Windows 7 x64 i used pecl install apc i got C:\PHPpecl install apc downloading APC-3.0.19.tgz ... Starting to download APC-3.0.19.tgz (115,735 bytes) ............done: 115,735 bytes 47 source files, building WARNING: php_bin c:\php\php.exe appears to have a suffix \php.exe, but config variable php_suffix does not match running: msdev APC.dsp /MAKE "APC - Release" ERROR: Did not understand the completion status returned from msdev.exe.

    Read the article

  • F#: Advantages of converting top-level functions to member methods?

    - by J Cooper
    Earlier I requested some feedback on my first F# project. Before closing the question because the scope was too large, someone was kind enough to look it over and leave some feedback. One of the things they mentioned was pointing out that I had a number of regular functions that could be converted to be methods on my datatypes. Dutifully I went through changing things like let getDecisions hand = let (/=/) card1 card2 = matchValue card1 = matchValue card2 let canSplit() = let isPair() = match hand.Cards with | card1 :: card2 :: [] when card1 /=/ card2 -> true | _ -> false not (hasState Splitting hand) && isPair() let decisions = [Hit; Stand] let split = if canSplit() then [Split] else [] let doubleDown = if hasState Initial hand then [DoubleDown] else [] decisions @ split @ doubleDown to this: type Hand // ...stuff... member hand.GetDecisions = let (/=/) (c1 : Card) (c2 : Card) = c1.MatchValue = c2.MatchValue let canSplit() = let isPair() = match hand.Cards with | card1 :: card2 :: [] when card1 /=/ card2 -> true | _ -> false not (hand.HasState Splitting) && isPair() let decisions = [Hit; Stand] let split = if canSplit() then [Split] else [] let doubleDown = if hand.HasState Initial then [DoubleDown] else [] decisions @ split @ doubleDown Now, I don't doubt I'm an idiot, but other than (I'm guessing) making C# interop easier, what did that gain me? Specifically, I found a couple *dis*advantages, not counting the extra work of conversion (which I won't count, since I could have done it this way in the first place, I suppose, although that would have made using F# Interactive more of a pain). For one thing, I'm now no longer able to work with function "pipelining" easily. I had to go and change some |> chained |> calls to (some |> chained).Calls etc. Also, it seemed to make my type system dumber--whereas with my original version, my program needed no type annotations, after converting largely to member methods, I got a bunch of errors about lookups being indeterminate at that point, and I had to go and add type annotations (an example of this is in the (/=/) above). I hope I haven't come off too dubious, as I appreciate the advice I received, and writing idiomatic code is important to me. I'm just curious why the idiom is the way it is :) Thanks!

    Read the article

  • JavaScript Regex Problem

    - by oraclee
    Hi all; Csharp Regex Pattern: Regex rg = new Regex("(?i)(?<=>)[^<]+(?=</TD>)"); JavaScript Regex Pattern: var pattern = (?i)(?<=>)[^<]+(?=</TD>); var result = str.match(pattern); Csharp Regex pattern work, but javascript regex pattern not work pls help ?

    Read the article

  • Python regex group clarification

    - by nkr1pt
    I have 0 experience with python, very little with regex and I'm trying to figure out what this small snippet of python regex would give back from a http response header Set-Cookie entry: REGEX_COOKIE = '([A-Z]+=[^;]+;)' resp = urllib2.urlopen(req) re.search(REGEX_COOKIE, resp.info()['Set-Cookie']).group(1) Can one give a simple example of a Set-Cookie value and explain what this would match on + return? Regards

    Read the article

  • How to obtain position in file (byte-position) from java scanner?

    - by september2010
    How to obtain a position in file (byte-position) from the java scanner? Scanner scanner = new Scanner(new File("file")); scanner.useDelimiter("abc"); scanner.hasNext(); String result = scanner.next(); and now: how to get the position of result in file (in bytes)? Using scanner.match().start() is not the answer, because it gives the position within internal buffer.

    Read the article

  • ClickOnce Deployment of an Application with more then one executable file

    - by Ahron Levi
    Hi I am trying to deploy an application with two executable files one of which is the application it self. I used the publish tub on the VS 2008 and tried to publish manually using the MageUI.exe. in both cases I get the "Reference in the manifest does not match the identity of the downloaded assembly" error in regards to the second executable file. Dose Any one know how to publish an application with two executable files? Thanks, Ahron

    Read the article

  • Regex Not Matching Unicode

    - by cam
    How would I go about using Regex to match Unicode strings? I'm loading in a couple keywords from a text file and using them with Regex on another file. The keywords both contain unicode (such á, etc). I'm not sure where the problem is. Is there some option I have to set?

    Read the article

  • F#: Recursive collect and filter over N-ary Tree

    - by RodYan
    This is hurting my brain! I want to recurse over a tree structure and collect all instances that match some filter into one list. Here's a sample tree structure type Tree = | Node of int * Tree list Here's a test sample tree: let test = Node((1, [Node(2, [Node(3,[]); Node(3,[])]); Node(3,[])])) Collecting and filtering over nodes with and int value of 3 should give you output like this: [Node(3,[]);Node(3,[]);Node(3,[])]

    Read the article

  • regex to parse a iCalendar file in ActionScript

    - by Mac Fly
    Hello, I use a library to parse an iCalendar file, but I don't understand the regex to split property. iCalendar property has 3 different style: BEGIN:VEVENT DTSTART;VALUE=DATE:20080402 RRULE:FREQ=YEARLY;WKST=MO The library uses this regex that I would like to understand: var matches:Array = data.match(/(.+?)(;(.*?)=(.*?)((,(.*?)=(.*?))*?))?:(.*)$/); p.name = matches[1]; p.value = matches[9]; p.paramString = matches[2]; Thanks.

    Read the article

  • java Regular expression matching html

    - by user121196
    I want to match and capture the enclosing content of the <pre></pre> tag tried the following, not working, what's wrong? String p="<pre>.*</pre>"; Matcher m=Pattern.compile(p,Pattern.MULTILINE|Pattern.CASE_INSENSITIVE).matcher(input); if(m.find()){ String g=m.group(0); System.out.println("g is "+g); }

    Read the article

  • My Access KeyChain certificate [Xcode]

    - by Momeks
    Hi , i create a provision and developer identity.certificate with apple provision assistant and i have huge problem , everything done , but when i add my certificate into KeyChain , the certificate add , but doesn't show on the Keys and my Certificate :( and xcode Organizer says a valid signing identity matching this profile could not be found in your keychain and compiler : Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain i didn't have this problem on the leopard with sdk 3.1 my current os is 10.6.2 SDK 3.1.3 what's the problem ?

    Read the article

  • Crystal reports - Encoding Issue UTF-8 / iso-8559-1

    - by Lloyd
    Hi, Has anyone had this error before when running reports in Crystal Reports 2008: Character set encoding from transport information [UTF-8] does not match with character set encoding in the received SOAP message [iso-8559]. I presume this indicates a file needs changing, but trying to fint it is causing me a real headache. There are references to UTF-8 all over the server. Any help would be great. Thanks, Lloyd.

    Read the article

  • .NET RegEx "Memory Leak" investigation

    - by Kevin Pullin
    I recently looked into some .NET "memory leaks" (i.e. unexpected, lingering GC rooted objects) in a WinForms app. After loading and then closing a huge report, the memory usage did not drop as expected even after a couple of gen2 collections. Assuming that the reporting control was being kept alive by a stray event handler I cracked open WinDbg to see what was happening... Using WinDbg, the !dumpheap -stat command reported a large amount of memory was consumed by string instances. Further refining this down with the !dumpheap -type System.String command I found the culprit, a 90MB string used for the report, at address 03be7930. The last step was to invoke !gcroot 03be7930 to see which object(s) were keeping it alive. My expectations were incorrect - it was not an unhooked event handler hanging onto the reporting control (and report string), but instead it was held on by a System.Text.RegularExpressions.RegexInterpreter instance, which itself is a descendant of a System.Text.RegularExpressions.CachedCodeEntry. Now, the caching of Regexs is (somewhat) common knowledge as this helps to reduce the overhead of having to recompile the Regex each time it is used. But what then does this have to do with keeping my string alive? Based on analysis using Reflector, it turns out that the input string is stored in the RegexInterpreter whenever a Regex method is called. The RegexInterpreter holds onto this string reference until a new string is fed into it by a subsequent Regex method invocation. I'd expect similar behaviour by hanging onto Regex.Match instances and perhaps others. The chain is something like this: Regex.Split, Regex.Match, Regex.Replace, etc Regex.Run RegexScanner.Scan (RegexScanner is the base class, RegexInterpreter is the subclass described above). The offending Regex is only used for reporting, rarely used, and therefore unlikely to be used again to clear out the existing report string. And even if the Regex was used at a later point, it would probably be processing another large report. This is a relatively significant problem and just plain feels dirty. All that said, I found a few options on how to resolve, or at least work around, this scenario. I'll let the community respond first and if no takers come forward I will fill in any gaps in a day or two.

    Read the article

< Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >