• Excellent Crash Reports

    I find that a majority of the crash reports that come in for ReceiptWallet have the following for the description:

     

    Yes, they are blank! While I appreciate people sending in crash reports (I read everyone of them and try to figure out the problem), having no description makes it much harder to figure out the problem. Today I received a blank description, but in reading the report, I was able to "reproduce it" (hard to reproduce when I wasn't told what happened) and quickly fixed it. I'm contemplating making description a required field for the report; this could reduce the reports which I don't want as it would give me a false view of how many crashes people are getting.

  • Filtering NSTextField - Take 2

    Thanks to Jim Correia of Bare Bones Software, I have a slightly different method for filtering NSTextFields based on an NSFormatter. While my older method worked, this is a bit cleaner.

    Like my old filter, this also has three methods:

    - (void) setAcceptableCharacterSet:(NSCharacterSet *) inCharacterSet;
    - (void) setMaximumLength:(int) inLength;
    - (void) setMaximumValue:(int) inValue;
    

    However, they're called differently. You'd do something like this:

    NSMutableCharacterSet *characterSet = [[NSMutableCharacterSet alloc] init];
    [characterSet addCharactersInString:@"0123456789"];
    [secondaryTextField setFormatter:[[[PartialFormatter alloc] init] autorelease]];
    [[secondaryTextField formatter] setMaximumValue:65535];
    [[secondaryTextField formatter] setAcceptableCharacterSet:characterSet];
    [characterSet release];
    

    Note that the formatter is based on NSFormatter and not NSNumberFormatter. I actually am using this for a number field as I want the number field to give me back a string instead of a number, so that's why I put in the setMaximumValue and didn't base it on NSNumberFormatter.

    As always, feedback is welcome.

    The attached code can be freely used in commercial and non-commercial projects. While I'd like some credit in the about box, it isn't necessary. This code has no warranty and you assume all risk for using it.

    Download source

  • Easiest update to WordPress yet!

    I saw that WordPress 2.5 was released and always dread updating my WordPress installations as I have to read the instructions so I don't screw it up. Well, today I decided to try out the update script I wrote and I was amazed (OK, I shouldn't have been amazed) that it took just a few seconds and the upgrade was done. Everything seemed to work and now I'm running WordPress 2.5 on 2 installations! I'm not sure what I get out of the new versions, but the admin interface looks cool. Thanks WordPress folks for the upgrade and if you upgrade your WordPress installation when new versions come out, definitely check out my script as it could save you a lot of time.

  • NSTextField's lack of filter capabilities

    I love Cocoa, but it seems that some simple things are missing. For example, NSTextField doesn't have the ability to filter text input as the user is typing. A friend reminded me that this is a feature that PowerPlant had ages ago. Cocoa has NSFormatters which allow the field to be validated after text is input, but in many cases, the right way to restrict input is to prevent it from being typed. I like NSFormatters and have created a very complex one to handle multiple currencies in ReceiptWallet, but I realized I needed something else.

    So, I present FilteringTextField. The attached code can be freely used in commercial and non-commercial projects. While I'd like some credit in the about box, it isn't necessary. This code has no warranty and you assume all risk for using it.

    The subclass of NSTextField, has 3 methods.

    - (void) setAcceptableCharacterSet:(NSCharacterSet *) inCharacterSet;
    - (void) setMaximumLength:(int) inLength;
    - (void) setMaximumValue:(int) inValue;
    

    The first lets you set the characters that can be typed; anything that isn't in the set is eaten. The second, only allows x characters to be typed and the last limits the value if the user is typing in a number. This class can easily be extended to handle other constraints. Pasting in text is also filtered.

    If anyone finds problems with this code, please let me know.

    Download source