Reduced PDF file size in Mac OS

Open ColorSync Utility in the Utilities folder off of the Applications folder. ColorSync Utility can create new Quartz filters. Open up ColorSync Utility and switch to the “Filters” pane. This will list all of the filters that you currently have available.
  1. In the lower left, click on the “+” button. This creates a new filter.
  2. Give the filter a name, and press return.
  3. To the right of the filter’s name, choose the down arrow. A menu will pop up.
  4. From the pop-up menu, choose “Add Image Effects Component”, and from that menu choose “Image Compression”.
  5. Adjust the image compression Mode to JPEG.
  6. Adjust the image compression quality however you prefer.
  7. The next time you use Preview to “Save As...”, you'll have a new option under Quartz filters.

Get First Letter/Character in String

NSString *firstLetter = [someGuysName substringToIndex:1];

Get All Local Notification

UIApplication *app = [UIApplication sharedApplication];
NSArray *alarmArray = [app scheduledLocalNotifications];

for (int i=0; i<[alarmArray count]; i++)
{
UILocalNotification* oneAlarm = [alarmArray objectAtIndex:i];
NSDictionary *userInfoCurrent = oneAlarm.userInfo;
NSDate *dateCurrent = [userInfoCurrent valueForKey:@"date"];
NSNumber *typeCurrent = [userInfoCurrent valueForKey:@"type"];
NSLog(@"Found scheduled alarm with date:%@, type:%@", dateCurrent,typeCurrent );
}

Cancel Local Notification

Cancel all local notifications with this code:
[[UIApplication sharedApplication] cancelAllLocalNotifications];

Cancel one local notification with this line of code:
[[UIApplication sharedApplication] cancelLocalNotification:theNotification];

Repeat Local Notification

NSInteger index = [scheduleControl selectedSegmentIndex];
switch (index) {
case 1:
notif.repeatInterval = NSMinuteCalendarUnit;
break;
case 2:
notif.repeatInterval = NSHourCalendarUnit;
break;
case 3:
notif.repeatInterval = NSDayCalendarUnit;
break;
case 4:
notif.repeatInterval = NSWeekCalendarUnit;
break;
default:
notif.repeatInterval = 0;
break;
}

  • NSEraCalendarUnit
  • NSYearCalendarUnit
  • NSMonthCalendarUnit
  • NSDayCalendarUnit
  • NSHourCalendarUnit
  • NSMinuteCalendarUnit
  • NSSecondCalendarUnit
  • NSWeekCalendarUnit
  • NSWeekdayCalendarUnit
  • NSWeekdayOrdinalCalendarUnit
  • NSQuarterCalendarUnit

Handling Local Notifications After They Fire

In your app delegate .m file and add the following code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Application was not running when notification was delivered.
Class cls = NSClassFromString(@"UILocalNotification");
if (cls) {
UILocalNotification *notification = [launchOptions objectForKey:
UIApplicationLaunchOptionsLocalNotificationKey];
if (notification) {
NSString *reminderText = [notification.userInfo
objectForKey:kRemindMeNotificationDataKey];
[viewController showReminder:reminderText];
}
}
application.applicationIconBadgeNumber = 0;
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}

- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif
{
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateInactive)
{
// Application was in the background when notification was delivered.
}
else
{
// Application was in the foreground when notification was delivered.
}
}

Schedule Local Notification

- (void) scheduleNotificationOn:(NSDate*) fireDate
text:(NSString*) alertText
action:(NSString*) alertAction
sound:(NSString*) soundfileName
launchImage:(NSString*) launchImage
andInfo:(NSDictionary*) userInfo
{
UILocalNotification *localNotification = [[UILocalNotification alloc] init];

NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *raceDate = [df dateFromString: [df stringFromDate: fireDate]];

//localNotification.fireDate = fireDate;
localNotification.fireDate = raceDate;
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = alertText;
localNotification.alertAction = alertAction;
if(soundfileName == nil)
{
localNotification.soundName = UILocalNotificationDefaultSoundName;
}
else
{
localNotification.soundName = soundfileName;
}
localNotification.alertLaunchImage = launchImage;
self.badgeCount ++;
localNotification.applicationIconBadgeNumber = self.badgeCount;
localNotification.userInfo = userInfo;
// Schedule it with the app
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[localNotification release];
}