depicus

changing the digital world one bit at a time...

Blants (noun) the rants of a blogger

  1. Writing to OS X ~/Library/Logs from your app

    June 18, 2011 by The Man

    In your main.m file just amend to look like the following.

    #import 
    
    int main(int argc, char *argv[]) {
        
        id pool = [NSAutoreleasePool new];
    	NSString *logPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Logs/Depicus"];
    	freopen([logPath fileSystemRepresentation], "a", stderr);
    	[pool release];
        
        return NSApplicationMain(argc,  (const char **) argv);
    }
    

  2. Wake On Lan hits controversy and 1.4

    December 1, 2010 by The Man

    Some people are not happy with me using analytics to see how you use the app and on what devices. Nothing nefarious it was just Google analytics for the iPhone which told me what buttons you pressed most.

    BUT if your not happy then I’m not happy. So I have removed all of it.

    I have also fixed a bug that would crash the app on 3.1.3 and lower devices. As ever should be live in about a week.


  3. iPhone App 1.3 – Forever in Review

    November 6, 2010 by The Man

    Well it’s been a week since v1.2 of the iPhone/iPad version of Wake On Lan was submitted to Apples app store. It’s the one annoying feature of the app store that you never know how long it will take. Thankfully I have been hard at work on 1.3 with more features so once 1.2 goes live I will submit 1.3. Here are a few screen shots to keep you going.

    1. The auto discovery page

    Discovery Page, current Arp Cache

    Discovery Page, current Arp Cache

    2. Doing some magic

    Doing some magic

    Doing some magic

    3. The end results

    The end results

    The end results

    And after a bit of tinkering


  4. Wake On Lan for OSX is live

    November 4, 2010 by The Man

    Well it’s not pretty but it works, will add more functionality if there is demand but for now here it is.

    Head on over to the main site to download.


  5. Because you can never trust a user…

    by The Man

    You will be surprised, or not, at the stuff people will try and type into UITextField boxes. Here is some code that uses shouldChangeCharactersInRange to a) check the characters entered and b) restrict the length and as a bonus add charachters that the user has to type.

    The field requires the user to input a mac address which is a alpha numeric field but letters are only valid up to F.

    As always this code is cobbled from other pioneers in the interweb, thanks to them.

    - (BOOL) textField:(UITextField*)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)textEntered 
    {
        if (textField.tag == 101)
        {
            NSCharacterSet *myMacAddress = [NSCharacterSet characterSetWithCharactersInString:@"0123456789abcdefABCDEF-:"];
        for (int i = 0; i < [textEntered length]; i++) 
        {
            unichar c = [textEntered characterAtIndex:i];
            if (![myMacAddress characterIsMember:c]) 
            {
                return NO;
            }
            if (([textField.text length] == 1) || ([textField.text length] == 4) || ([textField.text length] == 7) || ([textField.text length] == 10) || ([textField.text length] == 13))
            {
               [textField setText:[NSString stringWithFormat:@"%@%@-",[textField text],textEntered]]; 
                return NO;
            }
            int limit = 16;
            return !([textField.text length]>limit && [textEntered length] > range.length);
        } 
        }
        return YES;
    }
    

    Not perfect but better than nothing.