Question: I have a Rails application with Resque doing background jobs on multiple servers. The jobs are different in terms of their resource needs, so I would like to limit the amount of jobs of particular type, each server can do. I want to be able to have multiple servers query the same Redis database. 

Here is the scenario:
I have Server-1 and Server-2 connected to the same Redis database.

1) Each server should take 3 "Encoding" jobs and 5 "Parsing" jobs max (8 jobs total). 

2) At a given moment Redis-server will have 10 jobs in "Encoding" queue and 12 jobs in "Parsing" queue available for Resque workers to process. I have 2 servers running, quering the same database. 

QUESTION: How can I prevent Server-1 from taking 8 "Encoding" jobs and Server-2 taking the rest? In other words, how to restrict Server-1 to taking only 3 jobs from "Encoding" queue and 5 jobs from "Parsing" queue and have Server-2 do the same? 

I want to keep the code universal so that I can deploy it to multiple servers without individual tweaking..

Answer: 
```
- (BOOL) textField: (UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString: (NSString *)string {

    NSNumberFormatter * nf = [[NSNumberFormatter alloc] init];
    [nf setNumberStyle:NSNumberFormatterNoStyle];

    NSString * newString = [NSString stringWithFormat:@"%@%@",textField.text,string];
    NSNumber * number = [nf numberFromString:newString];

    if (number)
        return YES;
    else
       return NO;
}

```
Keep distinct presentation data from internal representation. There is a simpler way. Let `NSNumberFormatter` do the job:

```
 NSNumberFormatter* ns = [[NSNumberFormatter alloc] init];
 ns.numberStyle = NSNumberFormatterDecimalStyle;
 [ns setMaximumFractionDigits:2];
 // This is your internal representation of the localized number
 double a = [[ns numberFromString:self.textIVA.text] doubleValue]];

[mylabel setText:[NSString stringWithFormat:@"€ %@",
     [NSNumberFormatter localizedStringFromNumber:
                          [NSNumber numberWithDouble:a]
                                      numberStyle:NSNumberFormatterDecimalStyle]]];

```