Search Results

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

Page 90/841 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • How do I check if an instance has an object to skip displaying the values?

    - by Angela
    I have created a polymorphic association around a model called status. Some contacts will have a status associated with it. Many won't. If I try to call a status when one is not there, I get an error. Right now, even if I haven't created a status for the model, it still runs whatever is in the if-end block. Here's what I am trying, but it's not working: <% if [email protected]? %> <p>Status: <%= @status.find(:last).status %></p> <% end %> In the controller, it is defined below: @status = Contact.find(@contact).statuses By the way, also open to make code more readable and DRY.

    Read the article

  • How can I check with a regex that a string contains only certain allowed characters?

    - by Camran
    I need a special regular expression, have no experience in them whatsoever so I am turning to you guys on this one: I need to validate a classifieds title field so it doesn't have any special characters in it, almost. Only letters and numbers should be allowed, and also the swedish three letters å, ä, ö, and also not case sensitive. Besides the above, these should also be allowed: The "&" sign. Parenthesis sign "()" Mathematical signs "-", "+", "%", "/", "*" Dollar and Euro signs One accent signed letter: "é". //Only this one is required Double quote and singel quote signs. The comma "," and point "." signs Thanks

    Read the article

  • Possible for C++ template to check for a function's existence?

    - by andy
    Is it possible to write a C++ template that changes behavior depending on if a certain member function is defined on a class? Here's a simple example of what I would want to write: template<class T> std::string optionalToString(T* obj) { if (FUNCTION_EXISTS(T->toString)) return obj->toString(); else return "toString not defined"; } So if class T has "toString" defined then it uses it, otherwise it doesn't. The magical part that I don't know how to do is the "FUNCTION_EXISTS" part.

    Read the article

  • Are there any lint tools for C and C++ that check formatting?

    - by Nathan Fellman
    I have a codebase that is touched by many people. While most people make an effort to keep the code nicely formatted (e.g. consistent indentation and use of braces), some don't, and even those that do can't always do it because we all use different editors, so settings like spaces vs. tabs are different. Is there any standard lint tool that checks that code is properly formatted, but doesn't actually change it (like indent but that returns only errors and warnings)? While this question could be answered generally, my focus is on C and C++, because that's what this project is written in.

    Read the article

  • How do I check if a scalar has a compiled regex in it with Perl?

    - by Robert P
    Let's say I have a subroutine/method that a user can call to test some data that (as an example) might look like this: sub test_output { my ($self, $test) = @_; my $output = $self->long_process_to_get_data(); if ($output =~ /\Q$test/) { $self->assert_something(); } else { $self->do_something_else(); } } Normally, $test is a string, which we're looking for anywhere in the output. This was an interface put together to make calling it very easy. However, we've found that sometimes, a straight string is problematic - for example, a large, possibly varying number of spaces...a pattern, if you will. Thus, I'd like to let them pass in a regex as an option. I could just do: $output =~ $test if I could assume that it's always a regex, but ah, but the backwards compatibility! If they pass in a string, it still needs to test it like a raw string. So in that case, I'll need to test to see if $test is a regex. Is there any good facility for detecting whether or not a scalar has a compiled regex in it?

    Read the article

  • How do you check individual SqlCommands ran during a SqlTransactions to see if they will run?

    - by Sam F
    I've been reading up on SqlTransactions and have found a great load of examples like: http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=451 The problem is, when I do a BeginTransaction() (Execute all the commands) and then Commit() at the end all the commands I execute get run and the ones with syntax errors or other errors just get skipped. This is where I would also like to run a roll back, not skip over them. I found a few articles on the subject but they were not very helpful and purely in SQL. Is there any way to find out if one of the ExecuteNonQuery()'s failed before the commit and not just skipped? Thanks.

    Read the article

  • Why is my Android app force closing when I try to check if an EditText has a double

    - by user336861
    Scanner scanner = new Scanner(lapsPerMile_st); if (!scanner.hasNextDouble()) { Context context = getApplicationContext(); String msg = "Please Enter Digits and Decmials Only"; int duration = Toast.LENGTH_LONG; Toast.makeText(context, msg, duration).show(); lapsPerMileEditText.setText(""); return; } else { //Edit box has only digits, Set data and display stats data.setLapsPerMile(Integer.parseInt(lapsPerMile_st)); lapsRunLabel.setVisibility(0); lapsRunTextView.setText(Integer.toString(data.getLapsRun())); milesRunLabel.setVisibility(0); milesRunTextView.setText(Double.toString(data.getLapsRun()/data.getLapsPerMile())); } <EditText android:id="@+id/mileCount" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_marginTop="110dp" android:inputType="numberDecimal" android:maxLength="4" /> For some reason if I enter a non decimal number such as 3, or 5, it works fine but when I enter a floating point such as 3.4 or 5.8 it force closes. I cant seem to figure out whats going on. Any ideas? Thanks

    Read the article

  • How can I check if a Perl array contains a particular value?

    - by Mel
    I am trying to figure out a way of checking for the existence of a value in an array without iterating through the array. I am reading a file for a parameter. I have a long list of parameters I do not want to deal with. I placed these unwanted parameters in an array @badparams. I want to read a new parameter and if it does not exist in @badparams, process it. If it does exist in @badparams, go to the next read.

    Read the article

  • What is the fastest way to check if files are identical?

    - by ojblass
    If you have 1,000,0000 source files, you suspect they are all the same, and you want to compare them what is the current fasted method to compare those files? Assume they are Java files and platform where the comparison is done is not important. cksum is making me cry. When I mean identical I mean ALL identical. Update: I know about generating checksums. diff is laughable ... I want speed. Update: Don't get stuck on the fact they are source files. Pretend for example you took a million runs of a program with very regulated output. You want to prove all 1,000,000 versions of the output are the same. Update: read the number of blocks rather than bytes? Immediatly throw out those? Is that faster than finding the number of bytes? Update: Is this ANY different than the fastest way to compare two files?

    Read the article

  • Is there a "dual user check-in" source control system?

    - by Zubair
    Are there any source control systems that require another user to validate the source code "before" it can be checked-in? I want to know as this is one technique to make sure that code quality is high. Update: There has been talk of "Branches" in the answers, and while I feel branches have there place I think that branchs are something different as when a developer's code is ready to go into the main branch it "should" be checked. Most often though I see that when this happens a lead developer or whoever is responsible for the merge into the main branch/stream just puts the code into the main branch as long as it "compiles" and does no more checks than that. I want the idea of two people putting their names to the code at an early stage so that it introduces some responsibility, and also because the code is cheaper to fix early on and is also fresh in the developers mind.

    Read the article

  • Rails: Is there a way to check for incomplete JPG file upload?

    - by user206481
    I have a Rails app that processes and serves up jpg files that were uploaded via FTP. On several occasions the FTP process was disconnected and left many incomplete .jpg files. I was surprised to see that the incomplete jpgs behave as normal jpg files in my app even tho they have incomplete image data. I have since implemented a more robust FTP process where the uploaded file is initially *.tmp and gets renamed to .jpg after an FTP success code is received. My problem is, I still have all of these incomplete jpg files on the server and can't figure out how to programmatically weed them out. I can actually display them in a view without generating any errors, but there is only a partial image there. I tried RMagick but they all successfully load (using Image.read) and report the valid x & y resolutions. I have so far not been able to determine a way to programmatically differentiate between an incomplete and complete jpg uploaded image. Any ideas?

    Read the article

  • Fastest algorithm to check if a number is pandigital?

    - by medopal
    Pandigital number is a number that contains the digits 1..number length. For example 123, 4312 and 967412385. I have solved many Project Euler problems, but the Pandigital problems always exceed the one minute rule. This is my pandigital function: private boolean isPandigital(int n){ Set<Character> set= new TreeSet<Character>(); String string = n+""; for (char c:string.toCharArray()){ if (c=='0') return false; set.add(c); } return set.size()==string.length(); } Create your own function and test it with this method int pans=0; for (int i=123456789;i<=123987654;i++){ if (isPandigital(i)){ pans++; } } Using this loop, you should get 720 pandigital numbers. My average time was 500 millisecond. I'm using Java, but the question is open to any language.

    Read the article

  • jQuery: What listener do I use to check for browser auto filling the password input field?

    - by Jannis
    Hi, I have a simple problem that I cannot seem to find a solution to. Basically on this website here: http://dev.supply.net.nz/vendorapp/ (currently in development) I have some fancy label animations sliding things in and out on focus & blur. However once the user has logged in once the browser will most likely remember the password associated with the users email address/login. (Which is good and should not be disabled.) However I run into issues triggering my label slide out animation when the browser sets the value on the #password field automatically as the event for this is neither focus nor blur. Does anyone know which listener to use to run my function when the browser 'auto fills' the users password? Here is a quick screenshot of the issue:

    Read the article

  • How to check the system is Windows 7 or Windows Server 2008 RC in Wix Installer?

    - by Ray
    Hi there, I am working on a windows installer project. And now I only want the software only can be installed on Windows 7 or Windows Server 2008 RC system, I tried to use this: <Condition Message='Windows Server 2008 R2 or Windows 7 is required'>(VersionNT = 600 AND ServicePackLevel = 1) OR VersionNT = 601 </Condition> but it can still be installed on Windows Vista. Please help! Thank you!

    Read the article

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >