Archive

Archive for March, 2009

Lunch

March 20th, 2009

So good I
Jizz in my pants

mrsilver thought

iPhone development

March 18th, 2009

Listing 1-2 Handling a URL request based on a custom scheme

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
 
    if ([[url scheme] isEqualToString:@”todolist”]) {
 
        ToDoItem *item = [[ToDoItem alloc] init];
 
        NSString *taskName = [url query];
 
        if (!taskName || ![self isValidTaskString:taskName]) { // must have a task name
 
            [item release];
 
            return NO;
 
        }
 
        taskName = [taskName stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
 
 
        item.toDoTask = taskName;
 
        NSString *dateString = [url fragment];
 
        if (!dateString || [dateString isEqualToString:@"today"]) {
 
            item.dateDue = [NSDate date];
 
        } else {
 
            if (![self isValidDateString:dateString]) {
 
                [item release];
 
                return NO;
 
            }
 
            // format: yyyymmddhhmm (24-hour clock)
 
            NSString *curStr = [dateString substringWithRange:NSMakeRange(0, 4)];
 
            NSInteger yeardigit = [curStr integerValue];
 
            curStr = [dateString substringWithRange:NSMakeRange(4, 2)];
 
            NSInteger monthdigit = [curStr integerValue];
 
            curStr = [dateString substringWithRange:NSMakeRange(6, 2)];
 
            NSInteger daydigit = [curStr integerValue];
 
            curStr = [dateString substringWithRange:NSMakeRange(8, 2)];
 
            NSInteger hourdigit = [curStr integerValue];
 
            curStr = [dateString substringWithRange:NSMakeRange(10, 2)];
 
            NSInteger minutedigit = [curStr integerValue];
 
 
            NSDateComponents *dateComps = [[NSDateComponents alloc] init];
 
            [dateComps setYear:yeardigit];
 
            [dateComps setMonth:monthdigit];
 
            [dateComps setDay:daydigit];
 
            [dateComps setHour:hourdigit];
 
            [dateComps setMinute:minutedigit];
 
            NSCalendar *calendar = [NSCalendar currentCalendar];
 
            NSDate *itemDate = [calendar dateFromComponents:dateComps];
 
            if (!itemDate) {
 
                [dateComps release];
 
                return NO;
 
            }
 
            item.dateDue = itemDate;
 
            [dateComps release];
 
        }
 
 
        [(NSMutableArray *)self.list addObject:item];
 
        [item release];
 
        return YES;
 
    }
 
    return NO;
 
}
 

Be sure to validate the input you get from URLs passed to your application; see Validating Input in Secure Coding Guide to find out how to avoid problems related to URL handling. To learn about URL schemes defined by Apple, see Apple URL Scheme Reference.

Displaying Application Preferences

If your application uses preferences to control various aspects of its behavior, how you expose those preferences to the user depends on how integral they are to your program.

  • Preferences that are integral to using the application (and simple enough to implement directly) should be presented directly by your application using a custom interface.
  • Preferences that are not integral, or that require a relatively complex interface, should be into the system’s Settings application.

When determining whether a set of preferences is integral, think about the intended usage pattern. If you expect the user to make changes to preferences somewhat frequently, or if those preferences play a relatively important role in how the application behaves, they are probably integral. For example, the settings in a game are usually integral to playing the game and something the user might want to change quickly. Because the Settings application is a separate application, however, you would use it only for preferences that you do not expect the user to access frequently.

If you choose to implement preferences inside your application, it is up to you to define the interface and write the code to manage those preference. If you choose to use the Settings application, however, your application must provide a Settings bundle to manage them.

A settings bundle is a custom resource you include in the top level of your application’s bundle directory. An opaque directory with the name Settings.bundle, the settings bundle contains specially formatted data files (and supporting resources) that tell the Settings application how to display your preferences. These files also tell the Settings application where to store the resulting values in the preferences database, which your application then accesses using the NSUserDefaults or CFPreferences APIs.

If you implement your preferences using a settings bundle, you should also provide a custom icon for your preferences. The Settings application looks for an image file with the name Icon-Settings.png at the top level of your application bundle and displays that image next to your application name. The image file should be a 29 x 29 pixel PNG image file. If you do not provide this file at the top level of your application bundle, the Settings application uses a scaled version of your application icon (Icon.png) by default.

For more information about creating a Settings bundle for your application, see “Application Preferences.”

haha looks pretty hardcore to me. whats with that c shit playa????

mrsilver thought

what the fuck is hackingtosh?

March 18th, 2009

i started looking into if hyper-v can run os 10. downloading an iso 5 minutes later.

we shall see tonight!!! lol

mrsilver thought

iPhone

March 13th, 2009

Is sick

mrsilver thought

Stem cell approval cheered in California

March 10th, 2009

The Bush policy was founded in moral objections to the extraction of stem cells from human embryos, which are usually destroyed in the process. But Obama said the majority of Americans have concluded that the work holds the potential for medical advances and can be done within responsible, ethical boundaries.

barack is the man

Obama said he would attach signing statements to legislation “only when it is appropriate to do so as a means of discharging my constitutional responsibilities.” He also laid out a set of principles that will govern his use of signing statements.

that sly constitutionalist. you sly dog.

mrsilver thought

i cant breathe…

March 6th, 2009

if you can talk, you can breathe

this is common older / younger brother chit-chat as one strangles the other

good form young man

mrsilver thought

“scrubs is family guy with real people”

March 5th, 2009

-talon

mrsilver thought

the bust pays for itself

March 2nd, 2009

this is funny

weedbustcost.jpg

mrsilver thought