Search Results

Search found 4131 results on 166 pages for 'strong typing'.

Page 8/166 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • MVC2 Strong typing breaking changes...

    - by BitFiddler
    I had the code working for: http://stackoverflow.com/questions/1930229/post-idictionary-back-to-mvc-model I recently migrated to MVC2 and now all my collections/dictionaries are coming back null. I can't seem to find any information about what has changed in the new release to cause this. Anyone know of something that might help?

    Read the article

  • WPF Application Typing in Custom TextBox CPU Jumping from 3 to 80 percent

    - by azamsharp
    I have created a RichTextBox called SharpTextBox which indicates and limits the number of characters that can be typed in it. The implementation is shown in the following link: http://www.highoncoding.com/Articles/673_Creating_SharpRichTextBox_for_Live_Character_Count_in_WPF.aspx Anyway when I start typing in the TextBox it goes from 3% to 78%. The TextBox updates the Label control which shows the number of characters remaining for the count. How can I increase the performance of the textbox? UPDATE: I read there seems to be some problem with the TextRange.Text property which kills performance.

    Read the article

  • php regex for strong password validation

    - by Jason
    Hello, I've seen around the web the following regex (?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$ which validates only if the string: * contain at least (1) upper case letter * contain at least (1) lower case letter * contain at least (1) number or special character * contain at least (8) characters in length I'd like to know how to convert this regex so that it checks the string to * contain at least (2) upper case letter * contain at least (2) lower case letter * contain at least (2) digits * contain at least (2) special character * contain at least (8) characters in length well if it contains at least 2 upper,lower,digits and special chars then I wouldn't need the 8 characters length. special characters include: `~!@#$%^&*()_-+=[]\|{};:'".,/<? thanks in advance.

    Read the article

  • Javascript: Do processing when user has stopped typing

    - by Midhat
    I have a text box on a web page, whose value I want to send to a XMLHttpRequest. Now I want the user to just type the value, without pressing a button. But If i just send the request int he keyboard events, it will fire every time a key is pressed. So basically I want something liek this function KeyUpEvent() { if (user is still typing) return; else do processing } It would be great if the solution could come from plain javascript or mootools. I dont want to use any other library.

    Read the article

  • jquery to check when a someone starts typing in to a field

    - by Drew
    $('a#next').click(function() { var tags = $('input[name=tags]'); if(tags.val()==''){ tags.addClass('hightlight'); return false; }else{ tags.removeClass('hightlight'); $('#formcont').fadeIn('slow'); $('#next').hide('slow'); return false; } }); I would like the above code to fire the fadeIn as soon as somebody starts typing into the tags input. Can somebody tell me the correct way to do this or point me in the right direction? Thanks in advance EDIT here is the code to do it: $('input#tags').keypress(function() { $('#formcont').fadeIn('slow'); $('#next').hide('slow'); }); The only problem I've found is that my cursor no longer shows up in the text box. What am I doing wrong?

    Read the article

  • Wrap words in tags, keep markup

    - by spacevillain
    For example I have a string with markup (from html node): hello, this is dog "h<em>e<strong>llo, thi</strong>s i</em><strong>s d</strong>og" What is the most correct way to find some words in it (let's say "hello" and "dog"), wrap them in a span (make a highlight) and save all the markup? Desired output is something like this (notice properly closed tags) <span class="highlight">h<em>e<strong>llo</strong></em></span><strong>,</strong> <em><strong>thi</strong>s<em> i</em><strong>s <span class="highlight"><strong>d</strong>og</span> Looks the same as it should: hello, this is dog

    Read the article

  • deny direct access to a php file by typing the link in the url

    - by aeonsleo
    hi, I am using php session for a basic login without encryption for my site. I want to prevent a user from directly accessing a php page by typing the url when he/she is not signed in. But this is not happening. I am using session_start(), initializing session variables and aslo unsetting and destroying sesssion during logout. Also if I type the link in a different browser the page is getting displayed. I am not very well versed with php , only a beginner. I googled for such problem and found few alternatives as keeping all files in a seperate folder from the web root, using .htaccess etc. Can someone explain in simple terms what could be a good solution.thanks in advance.

    Read the article

  • establishing strong web security

    - by berj
    i have seen many sites who claim to have bank grade security encription. if their web sites have been built with php what other forms of security can exist aside from using mysql_real_escape_string and a 128bit ssl encription?

    Read the article

  • How to prevent users from typing incorrect inputs ?

    - by ZaZu
    Hello, I want the program to loop a scan function if the user types anything else other than numbers.. My code is : do{ printf("Enter rows\n"); scanf("%d",&row); }while(row>='a' && row<='z'); but this code doesnt work .. I keep getting an error when typing in a letter. I tried manipulating around it and the whole thing loops infinitely ... What am I doing wrong ? Please help thanks !

    Read the article

  • Disallow typing of few of characters e.g.'<', '>' in all input textboxes using jquery

    - by Ismail
    How do I achieve this:- When user types character like 'abcd' and then '>'(an invalid character for my application), I want to set the text back to 'abcd'. Better if we can cancel the input itself as we do in winforms application. This should happen when user is typing and not on a click of button. I want this to be applied on all text boxes in my web page. This will be easy if the solution is jQuery based. May be something which will start like this. $("input[type='text']")

    Read the article

  • Learning to implement dynamically typed language compiler

    - by TriArc
    I'm interested in learning how to create a compiler for a dynamically typed language. Most compiler books, college courses and articles/tutorials I've come across are specifically for statically typed languages. I've thought of a few ways to do it, but I'd like to know how it's usually done. I know type inferencing is a pretty common strategy, but what about others? Where can I find out more about how to create a dynamically typed language? Edit 1: I meant dynamically typed. Sorry about the confusion. I've written toy compilers for statically typed languages and written some interpreters for dynamically typed languages. Now, I'm interested in learning more about creating compilers for a dynamically typed language. I'm specifically experimenting with LLVM and since I need to specify the type of every method and argument, I'm thinking of ways to implement a dynamically typed language on something like LLVM.

    Read the article

  • unit testing variable state explicit tests in dynamically typed languages

    - by kris welsh
    I have heard that a desirable quality of unit tests is that they test for each scenario independently. I realised whilst writing tests today that when you compare a variable with another value in a statement like: assertEquals("foo", otherObject.stringFoo); You are really testing three things: The variable you are testing exists and is within scope. The variable you are testing is the expected type. The variable you are testing's value is what you expect it to be. Which to me raises the question of whether you should test for each of these implicitly so that a test fail would occur on the specific line that tests for that problem: assertTrue(stringFoo); assertTrue(stringFoo.typeOf() == "String"); assertEquals("foo", otherObject.stringFoo); For example if the variable was an integer instead of a string the test case failure would be on line 2 which would give you more feedback on what went wrong. Should you test for this kind of thing explicitly or am i overthinking this?

    Read the article

  • Can a loosely typed language be considered true object oriented?

    - by user61852
    Can a loosely typed programming language like PHP be really considered object oriented? I mean, the methods don't have returning types and method parameters has no declared type either. Doesn't class design require methods to have a return type? Don't methods signatures have specifically-typed parameters? How can OOP techniques help you code in PHP if you always have to check the types of parameters received because the language doesn't enforce types? Please, if I'm wrong, explain it to me. When you design things using UML, then code classes in PHP with no return-typed methods and no-type parameters... Is the code really compliant with the UML design? You spend time designing the architecture of your software, then the compiler doesn't force the programmer to follow your design while coding, letting he/she assign any object variable to any other variable with no "type-mismatch" warning.

    Read the article

  • What can Haskell's type system do that Java's can't?

    - by Matt Fenwick
    I was talking to a friend about the differences between the type systems of Haskell and Java. He asked me what Haskell's could do that Java's couldn't, and I realized that I didn't know. After thinking for a while, I came up with a very short list of minor differences. Not being heavy into type theory, I'm left wondering whether they're formally equivalent. To try and keep this from becoming a subjective question, I'm asking: what are the major, non-syntactical differences between their type systems? I realize some things are easier/harder in one than in the other, and I'm not interested in talking about those. And to make it more specific, let's ignore Haskell type extensions since there's so many out there that do all kinds of crazy/cool stuff.

    Read the article

  • What can Haskell's type system do that Java's can't and vice versa?

    - by Matt Fenwick
    I was talking to a friend about the differences between the type systems of Haskell and Java. He asked me what Haskell's could do that Java's couldn't, and I realized that I didn't know. After thinking for a while, I came up with a very short list of minor differences. Not being heavy into type theory, I'm left wondering whether they're formally equivalent. To try and keep this from becoming a subjective question, I'm asking: what are the major, non-syntactical differences between their type systems? I realize some things are easier/harder in one than in the other, and I'm not interested in talking about those. And to make it more specific, let's ignore Haskell type extensions since there's so many out there that do all kinds of crazy/cool stuff.

    Read the article

  • Type checking and recursive types (Writing the Y combinator in Haskell/Ocaml)

    - by beta
    When explaining the Y combinator in the context of Haskell, it's usually noted that the straight-forward implementation won't type-check in Haskell because of its recursive type. For example, from Rosettacode [1]: The obvious definition of the Y combinator in Haskell canot be used because it contains an infinite recursive type (a = a -> b). Defining a data type (Mu) allows this recursion to be broken. newtype Mu a = Roll { unroll :: Mu a -> a } fix :: (a -> a) -> a fix = \f -> (\x -> f (unroll x x)) $ Roll (\x -> f (unroll x x)) And indeed, the “obvious” definition does not type check: ?> let fix f g = (\x -> \a -> f (x x) a) (\x -> \a -> f (x x) a) g <interactive>:10:33: Occurs check: cannot construct the infinite type: t2 = t2 -> t0 -> t1 Expected type: t2 -> t0 -> t1 Actual type: (t2 -> t0 -> t1) -> t0 -> t1 In the first argument of `x', namely `x' In the first argument of `f', namely `(x x)' In the expression: f (x x) a <interactive>:10:57: Occurs check: cannot construct the infinite type: t2 = t2 -> t0 -> t1 In the first argument of `x', namely `x' In the first argument of `f', namely `(x x)' In the expression: f (x x) a (0.01 secs, 1033328 bytes) The same limitation exists in Ocaml: utop # let fix f g = (fun x a -> f (x x) a) (fun x a -> f (x x) a) g;; Error: This expression has type 'a -> 'b but an expression was expected of type 'a The type variable 'a occurs inside 'a -> 'b However, in Ocaml, one can allow recursive types by passing in the -rectypes switch: -rectypes Allow arbitrary recursive types during type-checking. By default, only recursive types where the recursion goes through an object type are supported. By using -rectypes, everything works: utop # let fix f g = (fun x a -> f (x x) a) (fun x a -> f (x x) a) g;; val fix : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b = <fun> utop # let fact_improver partial n = if n = 0 then 1 else n*partial (n-1);; val fact_improver : (int -> int) -> int -> int = <fun> utop # (fix fact_improver) 5;; - : int = 120 Being curious about type systems and type inference, this raises some questions I'm still not able to answer. First, how does the type checker come up with the type t2 = t2 -> t0 -> t1? Having come up with that type, I guess the problem is that the type (t2) refers to itself on the right side? Second, and perhaps most interesting, what is the reason for the Haskell/Ocaml type systems to disallow this? I guess there is a good reason since Ocaml also will not allow it by default even if it can deal with recursive types if given the -rectypes switch. If these are really big topics, I'd appreciate pointers to relevant literature. [1] http://rosettacode.org/wiki/Y_combinator#Haskell

    Read the article

  • Learning to implement dynamic language compiler

    - by TriArc
    I'm interested in learning how to create a compiler for a dynamic language. Most compiler books, college courses and articles/tutorials I've come across are specifically for statically typed languages. I've thought of a few ways to do it, but I'd like to know how it's usually done. I know type inferencing is a pretty common strategy, but what about others? Where can I find out more about how to create a dynamically typed language?

    Read the article

  • How do you navigate and refactor code written in a dynamic language?

    - by Philippe Beaudoin
    I love that writing Python, Ruby or Javascript requires so little boilerplate. I love simple functional constructs. I love the clean and simple syntax. However, there are three things I'm really bad at when developing a large software in a dynamic language: Navigating the code Identifying the interfaces of the objects I'm using Refactoring efficiently I have been trying simple editors (i.e. Vim) as well as IDE (Eclipse + PyDev) but in both cases I feel like I have to commit a lot more to memory and/or to constantly "grep" and read through the code to identify the interfaces. As for refactoring, for example changing method names, it becomes hugely dependent on the quality of my unit tests. And if I try to isolate my unit tests by "cutting them off" the rest of the application, then there is no guarantee that my stub's interface stays up to date with the object I'm stubbing. I'm sure there are workarounds for these problems. How do you work efficiently in Python, Ruby or Javascript?

    Read the article

  • New insights I can learn from the Groovy language

    - by Andrea
    I realize that, for a programmer coming from the Java world, Groovy contains a lot of new ideas and cool tricks. My situation is different, as I am learning Groovy coming from a dynamic background, mainly Python and Javascript. When learning a new language, I find that it helps me if I know beforehand which features are more or less old acquaintances under a new syntax and which ones are really new, so that I can concentrate on the latter. So I would like to know which traits distinguish Groovy among the dynamic languages. What are the ideas and insights that a programmer well-versed in dynamic languages should pay attention to when learning Groovy?

    Read the article

  • Dynamically load and call delegates based on source data

    - by makerofthings7
    Assume I have a stream of records that need to have some computation. Records will have a combination of these functions run Sum, Aggregate, Sum over the last 90 seconds, or ignore. A data record looks like this: Date;Data;ID Question Assuming that ID is an int of some kind, and that int corresponds to a matrix of some delegates to run, how should I use C# to dynamically build that launch map? I'm sure this idea exists... it is used in Windows Forms which has many delegates/events, most of which will never actually be invoked in a real application. The sample below includes a few delegates I want to run (sum, count, and print) but I don't know how to make the quantity of delegates fire based on the source data. (say print the evens, and sum the odds in this sample) using System; using System.Threading; using System.Collections.Generic; internal static class TestThreadpool { delegate int TestDelegate(int parameter); private static void Main() { try { // this approach works is void is returned. //ThreadPool.QueueUserWorkItem(new WaitCallback(PrintOut), "Hello"); int c = 0; int w = 0; ThreadPool.GetMaxThreads(out w, out c); bool rrr =ThreadPool.SetMinThreads(w, c); Console.WriteLine(rrr); // perhaps the above needs time to set up6 Thread.Sleep(1000); DateTime ttt = DateTime.UtcNow; TestDelegate d = new TestDelegate(PrintOut); List<IAsyncResult> arDict = new List<IAsyncResult>(); int count = 1000000; for (int i = 0; i < count; i++) { IAsyncResult ar = d.BeginInvoke(i, new AsyncCallback(Callback), d); arDict.Add(ar); } for (int i = 0; i < count; i++) { int result = d.EndInvoke(arDict[i]); } // Give the callback time to execute - otherwise the app // may terminate before it is called //Thread.Sleep(1000); var res = DateTime.UtcNow - ttt; Console.WriteLine("Main program done----- Total time --> " + res.TotalMilliseconds); } catch (Exception e) { Console.WriteLine(e); } Console.ReadKey(true); } static int PrintOut(int parameter) { // Console.WriteLine(Thread.CurrentThread.ManagedThreadId + " Delegate PRINTOUT waited and printed this:"+parameter); var tmp = parameter * parameter; return tmp; } static int Sum(int parameter) { Thread.Sleep(5000); // Pretend to do some math... maybe save a summary to disk on a separate thread return parameter; } static int Count(int parameter) { Thread.Sleep(5000); // Pretend to do some math... maybe save a summary to disk on a separate thread return parameter; } static void Callback(IAsyncResult ar) { TestDelegate d = (TestDelegate)ar.AsyncState; //Console.WriteLine("Callback is delayed and returned") ;//d.EndInvoke(ar)); } }

    Read the article

  • Eclipse (Aptana) Typing Lag

    - by Zack
    Hello SO, I've been using Aptana for some time now, and as of recent I've been dealing with files that are really, really big (500+ lines of code, which is huge for me, being a novice developer). Whenever I deal with smaller files, I get that weird sensation that I'm "in front of" what's typing, but now I'm quite sure of it--there is a significant lag between when I type something and when I see the text appear on screen. I don't have this issue with Dreamweaver CS3, so I know my computer has the capability to edit these files without this happening, but Eclipse still lags. I also don't see when something is being deleted if I hold down backspace, I see the first few characters get deleted, but then everything "hangs." Once I release the backspace key, the characters that would've been shown deleting instantly vanish all at once. The same thing happens with the forward delete key. I'm beginning to think this is an issue with Java, since I have the same feeling that everything is slightly "behind me" when I'm using -any- Java application. The computer is an intel Pentium 4 3.2 GHz Prescott, with 2GB's of DDR400 RAM and a Radeon HD3650 graphics card. If anyone knows how to fix this lagging issue, I'm all ears (eyes?); if anyone can recommend a different IDE with capabilities similar to Aptana (I do Python, HTML, CSS and JS; I use Git for SCM), I'd be glad to give it a try. Thanks!

    Read the article

  • Stop IE users typing into the file upload input

    - by Dexter
    My testers have discovered that if you type free text into a file upload input then none of the buttons on the page work until that text is removed (so the page cannot be submitted). I am able to replicate this with the following ASPX code (with no code behind): <%@ Page Language="C#" AutoEventWireup="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <form id="form1" runat="server"> <div> <asp:FileUpload ID="fuTest" runat="server" /> <asp:Button ID="btnSubmit" runat="server" Text="Submit" /> </div> </form> </body> </html> (Note that I haven't bound any handlers to the page; despite this, the page is submitted when the submit button is clicked only if no text is entered into the upload text box) Is there any way to prevent users from typing free text into a file upload control? It seems that this is only possible in IE - Firefox and Chrome natively prevent text from being entered into upload input fields. I've seen solutions elsewhere which suggest hiding input and replacing it with a label / button combo, but this seems like it might cause more problems and work inconsistently across browsers. Any thoughts?

    Read the article

  • How to use setTimeout / .delay() to wait for typing between characters

    - by Darcy
    Hi all, I am creating a simple listbox filter that takes the user input and returns the matching results in a listbox via javascript/jquery (roughly 5000+ items in listbox). Here is the code snippet: var Listbox1 = $('#Listbox1'); var commands = document.getElementById('DatabaseCommandsHidden'); //using js for speed $('#CommandsFilter').bind('keyup', function() { Listbox1.children().remove(); for (var i = 0; i < commands.options.length; i++) { if (commands.options[i].text.toLowerCase().match($(this).val().toLowerCase())) { Listbox1.append($('<option></option>').val(i).html(commands.options[i].text)); } } }); This works pretty well, but slows down somewhat when the 1st/2nd char's are being typed since there are so many items. I thought a solution I could use would be to add a delay to the textbox that prevents the 'keyup' event from being called until the user stops typing. The problem is, I'm not sure how to do that, or if its even a good idea or not. Any suggestions/help is greatly appreciated.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >