Search Results

Search found 21001 results on 841 pages for 'spelling check'.

Page 47/841 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • Null check error message as "is null" or "was null"

    - by Timo Westkämper
    When doing null checks in Java code, and you throw IllegalArgumentExceptions for null values, what kind of message template do you use? We tend to use something like this public User getUser(String username){ if (username == null){ throw new IllegalArgumentException("username is null"); } // ... } What is better : "is null" or "was null", and why? For me "is null" feels more natural.

    Read the article

  • regex to check string is certain length

    - by Aly
    Hi, I am trying to write a regex to match pairs of cards (AA, KK, QQ ... 22) and I have the regex ([AKQJT2-9])\1. The problem I have is that this regex will match AA as well as AAbc etc. Is there a way to write the regex such that I can specify I want to match ([AKQJT2-9])\1 and only that (i.e. no more characters after). Thanks

    Read the article

  • How to check absolute control visibility and how to be notified for changes of absolute visibility

    - by portakalla
    I have several controls inside my form and I perform several changes (Text, Font, BackColor etc.) on these controls. My changes are necessary only if the controls are visible. So, I want to stop performing my changes on controls that are not visible. I want to keep changing my controls when they become visible again. I can use Control.Visible and Control.VisibleChanged, however they are not satisfactory for my purpose. The problem is, VisibleChanged is not fired when control becomes invisible due to its parent (i.e. because its parent became invisible). Interestingly, it is fired when control becomes visible again. Is there a way to be notified for visibility changes without recursively listening parent visibility changes? I also want to be notified when another form is placed over my form and some of my controls become non-visible. I call this absolute visibility. (Is there another term for it?) Is there an event that I can use for this purpose? Thanks.

    Read the article

  • Python - Check if numbers in list are factors of a number

    - by Zach
    Hey, I have a list of numbers (integers) (say, from 1 to 10). They're not necessarily consecutive, but they are in ascending order. I've prompted the user multiple times to enter a choice of the available numbers. When that number is entered, it is removed from the list along with any of its factors that may be there. I've prevented the user from selecting prime numbers. However, at some point in time, there may be non-prime numbers there, which have no factors remaining. I'm relatively new to Python, so I'm having trouble implementing: Checking if the number selected has no factors remaining (even if it is not prime). Checking if only prime numbers remain, or numbers without factors. I'm thinking of using for statements, but I'm not sure exactly how to implement them. Can anyone offer advice, or code? Thanks in advance... PS. In case anyone's wondering, I'm doing an implementation of the game of Taxman in Python.

    Read the article

  • Rails: periodically use HEAD to check for page changes

    - by Chris
    I have a Rails app implementing a game, so it's expected that a player will leave a browser open at the game page. When player Alan takes an action himself, I use AJAX requests to update the game page Alan is viewing to reflect the new state. However, when another player (Bob) takes an action, I don't have (or want) a mechanism to push the change to Alan's view. I would like Alan's page to periodically poll the Rails server to find if there have been any changes since last reload, and to reload the page (either via a whole-page GET or an AJAX call) if not. In order to play nicely with caches and proxies, I'd like to do this by issuing a periodic HTTP HEAD request, get Rails to work out the timestamp of the last change (trivially available from my DB) and respond with that in the Last-Modified header; then have the client-side act on that timestamp. How can I go about doing this?

    Read the article

  • Check whether the string is a unix timestamp

    - by RHPT
    I have a string and I need to find out whether it is a unix timestamp or not, how can I do that effectively? I found this thread via Google, but it doesn't come up with a very solid answer, I'm afraid. (And yes, I cribbed the question from the original poster on the aforementioned thread). http://www.sitepoint.com/forums/showthread.php?t=585963

    Read the article

  • ASP.NET MVC check form input is valid on submit

    - by Gavin
    Hi all, I have a form that when submitted shows a busy animation and disables the submit button. Anyone know how to query Microsoft's Sys.Mvc.FormValidation to see if the form passed it's test so I can prevent the busy animation showing if the form hasn't actually been submitted? Or even some other work-around? At present my client side javascript looks like this: $('form').submit(function() { $('input[type=submit]', this).attr('disabled', 'disabled'); ShowBusy(); }); Cheers, Gavin

    Read the article

  • Check if thread is EDT is necessary?

    - by YuppieNetworking
    Hello, I have an UI implemented with Swing. One component does some work that may take some time, so I use SwingUtilities.invokeLater. However, I was reading some old code and found this in an ActionListener: if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(new Runnable() { public void run() { // code X } }); } else { // code X } I thought that it made sense since it separates code X from the EDT. However, I found it error-prone since I have used it a couple of times and both times I forgot the else part. The question is: is the SwingUtilities.isEventDispatchThread() checking necessary? Or could I assume that I am not in the EDT and always use invokeLater? Thanks a lot.

    Read the article

  • Check firebird databases present

    - by Ronaldo Junior
    Our software installer install firebird if it is not present on the system and, as we are pursuing Win certificate the uninstaller should remove it but, we want to make sure that even if it was the installer that put it there, if any new software is using it now with a new database, we would not remove it (Firebird). The question is: Is it possible to query the server and ask what are the databases running on it? This is it so that we can decide, automatically if we can remove the database or not. A few extra info: Our installer is Innosetup and it does a good job already - we just trying to make it smarter because of the "Developed by" or "Compatible with" windows logo.

    Read the article

  • check status application pool iis7 with csharp (access-denied)

    - by jack
    I need to monitor the status of an application in the applications pool of IIS 7 from an other machine on the same domain. My monitoring application must be in C# and running as a Windows service. On my server, I create a user with administration rights and I execute the command aspnet_regiis -ga machine\username wich worked succesfully. My problem is when I try to access the application pool i still get COMExcepttion "Access denied". What did i do wrong or wich step did i miss? I used code from http://patelshailesh.com/index.php/create-a-website-application-pool-programmatically-using-csharp as example. int status = 0; string ipAddress = "10.20.2.13"; string username = "username"; string password = "password"; try { DirectoryEntry de = new DirectoryEntry(string.Format("IIS://{0}/W3SVC/AppPools/MyAppPoolName", ipAddress), username, password); //the exception is thron here. status = (int)de.InvokeGet("AppPoolState"); switch (status) { case 2: //Runnig break; case 4: //Stopped break; default: break; } } catch (Exception ex) { }

    Read the article

  • How to have a PHP Website tool with a version check

    - by Sara
    Hi, So I work on a small php website tool that a few people use and what I'm looking to have added is a little version checker in it. The tool is normally hosted by others on different servers/domains/whatever have you so I'm having a bit of a trouble figuring out how I can accomplish this and do so in the best possible method. So what I'm looking to do is have a webpage that just has a number on it which is the latest version. Lets say 3.2.2 is displayed on www.myawesomephptool.com/version.html in some way shape or form . Now on their installation when they open up their admin page it pulls in that 3.2.2 as the latest version to see if they are on that version. So trying to keep it simple on requirements too. Thanks for any help or suggestions, Sara

    Read the article

  • Change Check Out Folder for checked out files in SourceSafe

    - by Town
    I had to rebuild my machine and went from XP to Windows 7. I've now got a bit of an issue: I had files checked out in SourceSafe previously, which I still have copies of in the local folder on my new install. However, SourceSafe still has them checked out to the old XP folder (c:\documents and settings etc) whereas the files now reside in c:\Users. Pending Checkins in Visual Studio now thinks I have nothing checked out, and SourceSafe declares that the files are checked out to me under the c:\documents and settings\ path. Is there any way to tell SourceSafe to simply "look over there" for the files instead? It seems to work with individually undoing and redoing checkout on the files, but that's a lengthy process and one I'd like to avoid if possible. If I simply checkout the files individually then it lists them as checked out to me twice, one for each of the locations. Any pointers would be very much appreciated!

    Read the article

  • How to check for mutual existence of Fields in same table in Two columns

    - by ranabra
    I tried using "Exist" and "IN". Not only did I not succeed, it didn't seem as an efficient solution. Here is a simplified example: TblMyTable WorkerUserName  -  WorkerDegree  -  ManagerUserName  -  ManagerDegree I need a query where there is a mutual connection / existence. What I mean is only where the worker, ex. "John" has a manager named "Mary", and where Mary the manager has a worker named "John". John the worker can have several managers and Mary the manager can have several workers. So the result will be (the order doesn't matter) ideally in one line: John - BSc  --  Mary - M.A. or Mary - M.A.  --  John - BSc The punchline is it's only one table. it is not really managers and workers, this is just a simplification of the situation. In the real situation both are equal, in a Table of names of users working with other users. Database is SQL 2005. Many thanx in advance  

    Read the article

  • shell scripting: search/replace & check file exist

    - by johndashen
    I have a perl script (or any executable) E which will take a file foo.xml and write a file foo.txt. I use a Beowulf cluster to run E for a large number of XML files, but I'd like to write a simple job server script in shell (bash) which doesn't overwrite existing txt files. I'm currently doing something like #!/bin/sh PATTERN="[A-Z]*0[1-2][a-j]"; # this matches foo in all cases todo=`ls *.xml | grep $PATTERN -o`; isdone=`ls *.txt | grep $PATTERN -o`; whatsleft=todo - isdone; # what's the unix magic? #tack on the .xml prefix with sed or something #and then call the job server; jobserve E "$whatsleft"; and then I don't know how to get the difference between $todo and $isdone. I'd prefer using sort/uniq to something like a for loop with grep inside, but I'm not sure how to do it (pipes? temporary files?) As a bonus question, is there a way to do lookahead search in bash grep? To clarify: so the simplest way to do what i'm asking is (in pseudocode) for i in `/bin/ls *.xml` do replace xml suffix with txt if [that file exists] add to whatsleft list end done

    Read the article

  • C#, AES encryption check!

    - by Data-Base
    I have this code for AES encryption, can some one verify that this code is good and not wrong? it works fine, but I'm more concern about the implementation of the algorithm // Plaintext value to be encrypted. //Passphrase from which a pseudo-random password will be derived. //The derived password will be used to generate the encryption key. //Password can be any string. In this example we assume that this passphrase is an ASCII string. //Salt value used along with passphrase to generate password. //Salt can be any string. In this example we assume that salt is an ASCII string. //HashAlgorithm used to generate password. Allowed values are: "MD5" and "SHA1". //SHA1 hashes are a bit slower, but more secure than MD5 hashes. //PasswordIterations used to generate password. One or two iterations should be enough. //InitialVector (or IV). This value is required to encrypt the first block of plaintext data. //For RijndaelManaged class IV must be exactly 16 ASCII characters long. //KeySize. Allowed values are: 128, 192, and 256. //Longer keys are more secure than shorter keys. //Encrypted value formatted as a base64-encoded string. public static string Encrypt(string PlainText, string Password, string Salt, string HashAlgorithm, int PasswordIterations, string InitialVector, int KeySize) { byte[] InitialVectorBytes = Encoding.ASCII.GetBytes(InitialVector); byte[] SaltValueBytes = Encoding.ASCII.GetBytes(Salt); byte[] PlainTextBytes = Encoding.UTF8.GetBytes(PlainText); PasswordDeriveBytes DerivedPassword = new PasswordDeriveBytes(Password, SaltValueBytes, HashAlgorithm, PasswordIterations); byte[] KeyBytes = DerivedPassword.GetBytes(KeySize / 8); RijndaelManaged SymmetricKey = new RijndaelManaged(); SymmetricKey.Mode = CipherMode.CBC; ICryptoTransform Encryptor = SymmetricKey.CreateEncryptor(KeyBytes, InitialVectorBytes); MemoryStream MemStream = new MemoryStream(); CryptoStream CryptoStream = new CryptoStream(MemStream, Encryptor, CryptoStreamMode.Write); CryptoStream.Write(PlainTextBytes, 0, PlainTextBytes.Length); CryptoStream.FlushFinalBlock(); byte[] CipherTextBytes = MemStream.ToArray(); MemStream.Close(); CryptoStream.Close(); return Convert.ToBase64String(CipherTextBytes); } public static string Decrypt(string CipherText, string Password, string Salt, string HashAlgorithm, int PasswordIterations, string InitialVector, int KeySize) { byte[] InitialVectorBytes = Encoding.ASCII.GetBytes(InitialVector); byte[] SaltValueBytes = Encoding.ASCII.GetBytes(Salt); byte[] CipherTextBytes = Convert.FromBase64String(CipherText); PasswordDeriveBytes DerivedPassword = new PasswordDeriveBytes(Password, SaltValueBytes, HashAlgorithm, PasswordIterations); byte[] KeyBytes = DerivedPassword.GetBytes(KeySize / 8); RijndaelManaged SymmetricKey = new RijndaelManaged(); SymmetricKey.Mode = CipherMode.CBC; ICryptoTransform Decryptor = SymmetricKey.CreateDecryptor(KeyBytes, InitialVectorBytes); MemoryStream MemStream = new MemoryStream(CipherTextBytes); CryptoStream cryptoStream = new CryptoStream(MemStream, Decryptor, CryptoStreamMode.Read); byte[] PlainTextBytes = new byte[CipherTextBytes.Length]; int ByteCount = cryptoStream.Read(PlainTextBytes, 0, PlainTextBytes.Length); MemStream.Close(); cryptoStream.Close(); return Encoding.UTF8.GetString(PlainTextBytes, 0, ByteCount); } Thank you

    Read the article

  • ASP .NET Code analysis tool to check cross site scripting

    - by Prashant
    I am aware of a tool which MS has provided which tells you about coss site scripting attack etc. The tool is http://www.microsoft.com/downloads/details.aspx?FamilyId=0178e2ef-9da8-445e-9348-c93f24cc9f9d&displaylang=en But are there tools which you have used for ASP .NET applications which do similar to this and which one is widely used in ASP .Net applications ?

    Read the article

  • Regex to check that a character in range doesn't repeat

    - by Aly
    Hi, I want to match against Strings such as AhKs & AdKs (i.e. two cards Ah = Ace of Hearts). I want to match two off-suit cards with a regex, what I currently have is "^[AKQJT2-9][hscd]{2}$", but this could match hands such as AhKh (suited) and AhAh. Is there a way to possibly use backreferences to say the second [hscd] cannot be the same as the firs (similarly for [AKQJT2-9])

    Read the article

  • Localization — how to check that Filename1 and Filename2 are the same

    - by modosansreves
    I want to know that Filename1, provided by the user is the same as stored in DB (Filename2). I was about to use string.Equals(Filename1, Filename2, StringComparison.CurrentCultureIgnoreCase) but then I doubted whether I should use StringComparison.InvariantCultureIgnoreCase. Obviously, I need to do this the same way OS does, or use appropriate API. In some cultures, AFAIK, characters (e.g. vocals) may change if the next one is Capitalized. As I primarily target English-speaking market, I'd like my software to work well throughout the world.

    Read the article

  • How to read dynamical added check box?

    - by Manoj
    Hi, I am adding checkboxes dynamically to silverlight stackpanel object as follows: foreach (String userName in e.Result) { CheckBox ch = new CheckBox(); ch.Name = userName; ch.Content = userName; ContentStackPanel.Children.Add(ch); } How do I read back those controls to detect which of them are checked.

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >