Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 42/448 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • JavaScript - checking for any lowercase letters in a string

    - by pcampbell
    Consider a JavaScript method that needs to check whether a given string is in all uppercase letters. The input strings are people's names. The current algorithm is to check for any lowercase letters. var check1 = "Jack Spratt"; var check2 = "BARBARA FOO-BAR"; var check3 = "JASON D'WIDGET"; var isUpper1 = HasLowercaseCharacters(check1); var isUpper2 = HasLowercaseCharacters(check2); var isUpper3 = HasLowercaseCharacters(check3); function HasLowercaseCharacters(string input) { //pattern for finding whether any lowercase alpha characters exist var allLowercase; return allLowercase.test(input); } Is a regex the best way to go here? What pattern would you use to determine whether a string has any lower case alpha characters?

    Read the article

  • Checking only "Automatic" services with powershell.

    - by Lee
    I've seen lots of scripts out there for manually stopping/starting services in a list, but how can I generate that list programatically of -just- the automatic services. I want to script some reboots, and am looking for a way to verify that everything did in fact start up correctly for any services that were supposed to.

    Read the article

  • Checking contents of Uploaded file

    - by kapil
    Hi all, I am using ASP.NEt MVC . I want to upload .zip files for which I am using html input file upload control on my view. I want only .zip files to be uploaded. I want to check that my .zip contains only two files - both having extensions .txt and one of them having name "start". Can anyone please suggest me about how to check this? How can we assure that the uploaded .zip is really a zipped folder and not any other file having just .zip extension. can we use HttpPostedFileBase.ContentType? thanks in advance, kaps

    Read the article

  • Checking instance of non-class constrained type parameter for null in generic method

    - by casperOne
    I currently have a generic method where I want to do some validation on the parameters before working on them. Specifically, if the instance of the type parameter T is a reference type, I want to check to see if it's null and throw an ArgumentNullException if it's null. Something along the lines of: // This can be a method on a generic class, it does not matter. public void DoSomething<T>(T instance) { if (instance == null) throw new ArgumentNullException("instance"); Note, I do not wish to constrain my type parameter using the class constraint. I thought I could use Marc Gravell's answer on "How do I compare a generic type to its default value?", and use the EqualityComparer<T> class like so: static void DoSomething<T>(T instance) { if (EqualityComparer<T>.Default.Equals(instance, null)) throw new ArgumentNullException("instance"); But it gives a very ambiguous error on the call to Equals: Member 'object.Equals(object, object)' cannot be accessed with an instance reference; qualify it with a type name instead How can I check an instance of T against null when T is not constrained on being a value or reference type?

    Read the article

  • SVN: Checking out a large project over slow connection

    - by far
    Hello, I am new to SVN. I want to check out a very large project over a slow connection which takes ages to download. I have zipped versions of project on both remote server and my local which are identical. Is there an easy and quick way to sync my local project with remote server without a full checkout? Thanks

    Read the article

  • Reflection in unit tests for checking code coverage

    - by Gary
    Here's the scenario. I have VO (Value Objects) or DTO objects that are just containers for data. When I take those and split them apart for saving into a DB that (for lots of reasons) doesn't map to the VO's elegantly, I want to test to see if each field is successfully being created in the database and successfully read back in to rebuild the VO. Is there a way I can test that my tests cover every field in the VO? I had an idea about using reflection to iterate through the fields of the VO's as part of the solution, but maybe you guys have solved the problem before? I want this test to fail when I add fields in the VO, and don't remember to add checks for it in my tests.

    Read the article

  • Checking for duplicates in a vector

    - by xbonez
    I have to check a vector for duplicates. What is the best way to approach this: I take the first element, compare it against all other elements in the vector. Then take the next element and do the same and so on. Is this the best way to do it, or is there a more efficient way to check for dups?

    Read the article

  • Checking if a record in datareader is NULL

    - by user279521
    I have browsed thru other postings on S/O, but I can't find a solution that works for me. I have a datareader that might return a null value, and if so, I want to value to equal blank txtMiddleName.Text = rdrGetUserInfo.GetString(1) ?? ""; The string above does not work. When I walk thru the code, the code jumps to my error trapping block; Any ideas?

    Read the article

  • Checking if a console application is still running using the Process class

    - by Ced
    I'm making an application that will monitor the state of another process and restart it when it stops responding, exits, or throws an error. However, I'm having trouble to make it reliably check if the process (Being a C++ Console window) has stopped responding. My code looks like this: public void monitorserver() { while (true) { server.StartInfo = new ProcessStartInfo(textbox_srcdsexe.Text, startstring); server.Start(); log("server started"); log("Monitor started."); while (server.Responding) { if (server.HasExited) { log("server exitted, Restarting."); break; } log("server is running: " + server.Responding.ToString()); Thread.Sleep(1000); } log("Server stopped responding, terminating.."); try { server.Kill(); } catch (Exception) { } } } The application I'm monitoring is Valve's Source Dedicated Server, running Garry's Mod, and I'm over stressing the physics engine to simulate it stopping responding. However, this never triggers the process class recognizing it as 'stopped responding'. I know there are ways to directly query the source server using their own protocol, but i'd like to keep it simple and universal (So that i can maybe use it for different applications in the future). Any help appreciated

    Read the article

  • Automated URL checking from a MySQL table

    - by Rob
    Okay, I have a list of URLs in a MySQL table. I want the script to automatically check each link in the table for 404, and afterward I want it to store whether the URL was 404'd or not, as well as store a time for last checked. Is this even possible to do automatically, even if no one runs the script? ie, no one visits the page for a few days, but even with no one visiting the page, it automatically ran the test. If its possible, how could I go about making a button to do this?

    Read the article

  • Tool for checking source for dependencies on specific Java versions

    - by Gregor
    Is there a quick way (e.g. tool) to detect, from the source (or maybe even from compiled classes), which parts of an application call Java API methods that are only implemented in a specific Java version? (e.g. which parts of my app are Java6-specific) I don't necessarily want to hop through all ClassMismatchErrors and avoid the trial-and-error-method. Let's say I only want to document which parts of an application won't work if they were writte for, e.g., Java6 and I want to run it in a version 5 JDK. Is there something like this? Google did not help this time, nor did I find any solution here (a rare case indeed:)

    Read the article

  • Checking if an object has been released before sending a message to it

    - by Tom Irving
    I've only recently noticed a crash in one of my apps when an object tried to message its delegate and the delegate had already been released. At the moment, just before calling any delegate methods, I run this check: if (delegate && [delegate respondsToSelector:...]){ [delegate ...]; } But obviously this doesn't account for if the delegate isn't nil, but has been deallocated. Besides setting the object's delegate to nil in the delegate's dealloc method, is there a way to check if the delegate has already been released just incase I no longer have a reference to the object.

    Read the article

  • Checking lazy loaded properties have been instantiated

    - by PaulG
    In a class which has a lazy loaded property, such as: private Collection<int> someInts; public Collection<int> SomeInts { get { if (this.someInts == null) this.someInts = new Collection<int>(); return this.someInts; } } Is it worth also having a property such as: public bool SomeIntsExist { get { return (this.someInts != null && this.someInts.Count > 0); } } And then using that property.. eg: if (thatClass.SomeIntsExist) { // do something with thatClass.SomeInts collection } or is this premature optimisation. Its certainly easier to roll with something like below, but it will instantiate the collection needlessly: if (thatClass.SomeInts.Count > 0) { // do something with thatClass.SomeInts collection } Is the compiler smart enough to figure things like this out? Is there a better way?

    Read the article

  • Checking date against date range in Python

    - by Flowpoke
    I have a date variable: 2011-01-15 and I would like to get a boolean back if said date is within 3 days from TODAY. Im not quite sure how to construct this in Python. Im only dealing with date, not datetime. My working example is a "grace period". A user logs into my site and if the grace period is within 3 days of today, additional scripts, etc. are omitted for that user. I know you can do some fancy/complex things in Python's date module(s) but Im not sure where to look.

    Read the article

  • Basic Conditional Checking for IF statements in C

    - by ZaZu
    Hi there, Can someone please explain what really goes on in this code ? If I put the AND statement, the message wont show if values are less than 0 or greater than 10 ... I think I must use 1 0 logic to work this out right ? I just need someone to briefly explain it please. #include<stdio.h> main(){ puts("enter number"); scanf("%d",num); if(num<0 || num >10) puts("yay"); } How is that IF statement different when AND is put : #include<stdio.h> main(){ puts("enter number"); scanf("%d",num); if(num<0 && num >10) puts("yay"); } Thanks !!

    Read the article

  • Alternatives to checking against the system time

    - by vikp
    Hi, I have an application which license should expire after some period of time. I can check the time in the applicatino against the system time, but system time can be changed by the administrator, therefore it's not a good idea to check against the system time in my opinion. What alternatives do I have? Thank you

    Read the article

  • linq delegate function checking from objects

    - by Philip
    I am trying to find the list of objects which can be replaced. Class Letter{ int ID; string Name; string AdvCode; int isDeleted; } Class Replacers{ int ID; string MainAdvCode; string ReplacesAdvCode; } example data: Replacers 0 455 400 1 955 400 2 955 455 such that if a Letter has and Advcode of 455 and another has a code of 400 the 400 gets marked for deletion. And then if another Letter has a 955 then the 455 gets marked for deletion and the 400 (which is already marked) is marked for deletion. The problem is with my current code the 400 and 455 is marking itself for deletion?!?!? Public class Main{ List<Letter> Letters; List<Replacers> replaces; //select the ones to replace the replacements aka the little guys //check if the replacements replacer exists if yes mark deleted var filterMethodReplacements = new Func<Letter, bool>(IsAdvInReplacements);//Working var filterMethodReplacers = new Func<Letter, bool>(IsAdvInReplacers);//NOT WORKING???? var resReplacements=letters.Where(filterMethodReplacements);//working foreach (Letter letter in resReplacements) { //select the Replacers aka the ones that contain the little guys var resReplacers = letters.Where(filterMethodReplacers); if (resReplacers != null) letter.isDeleted = 1; } } } private bool IsAdvInReplacements(Letter letter) { return (from a in Replacables where a.ReplaceAdvCode == letter.AdvCode select a).Any(); } private bool IsAdvInReplacers(Letter letter) { //?????????????????????????????? return (from a in Replacables where a.MainAdvCode == letter.AdvCode select a).Any(); } }

    Read the article

  • Java: Checking contents of char variable with if condition

    - by Troy
    Hello, I have a char variable that is supposed to contain either a Y,y,n or N character, I want to test if it does not contain it, then display an error message and exit the program. This is the code I am using; if (userDecision != 'Y' || userDecision != 'y' || userDecision != 'n' || userDecision != 'N') { System.out.println("Error: invalid input entered for the interstate question"); System.exit(0); } Irregardless of what is in the variable it always returns true and executes the command to exit the program, what am I doing wrong?

    Read the article

  • Checking for uppercase/lowercase/numbers with Jquery

    - by user1725794
    Either I'm being really retarded here or its just the lack of sleep but why doesn't this work? If I use the "or" operator it works for each separate test but as soon as it change it to the "and" operator it stops working. I'm trying to test the password input of a form to see if its contains lowercase, uppercase and at least 1 number of symbol. I'm having a lot of trouble with this so help would be lovely, here is the code I have. var upperCase= new RegExp('[^A-Z]'); var lowerCase= new RegExp('[^a-z]'); var numbers = new RegExp('[^0-9]'); if(!$(this).val().match(upperCase) && !$(this).val().match(lowerCase) && !$(this).val().match(numbers)) { $("#passwordErrorMsg").html("Your password must be between 6 and 20 characters. It must contain a mixture of upper and lower case letters, and at least one number or symbol."); } else { $("#passwordErrorMsg").html("OK") }

    Read the article

  • Checking for empty variable in PHPTAL condition

    - by kodziek
    In PHPTAL tal:condition can check is variable empty? Something like that: < tag tal:condition="var" >Some text< /tag > but the value of variable is like that: <?php $variable = ''; $Tpl->var = $variable; ?> And it's a problem 'cause PHPTAL that value '' interpreting like not empty value and condition return true. How fix it in PHPTAL side?

    Read the article

  • Good link checking tool?

    - by AP257
    Hi all Can anyone recommend a good, free link checker to check all pages within a domain? Ideally a browser add-on or a web app (otherwise something that runs on OSX). Crucially it needs to follow links recursively within a domain. Links outside the domain should be followed to a depth of 1, but not checked recursively. This is for the fairly common situation where you want to check all pages on your own site, but not evaluate the links on e.g. Google's homepage. I can't find anything suitable. Am I missing something? I've tried the Firefox LinkChecker add-on and the W3C link validator - neither seem to have the 'follow recursively within a domain' property, or am I being dumb? I know Xenu does this, but I don't run Windows.

    Read the article

  • Hibernate object equality checking

    - by Sujee
    As far as I understand(correct me if I am wrong) Hibernate uses object reference to check the object equality. When Hibernate identifies that there are more than one objects attached to same DB record, it throws following exception. "a different object with the same identifier value was already associated with the session" My question is, does Hibernate use equal() method to check the object equality (The default equal method uses object reference)? If it is true, will overridden equal() method change the Hibernate behavior? Note: My question is not about the issues of implementing equal() or hashCode() methods in a Hibernate persisted object. Thank you.

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >