Tuesday, April 8, 2014

Bucketlist

1.  Win a boxing match
2.  Climb Kilimanjaro
3.  Take a picture of a lion
4.  Take a picture of a cheetah
5.  Take a picture of a rhino
6.  Take a picture of a hippo
7.  Place in a sailing race
8.  Climb Mt. Fuji
9.  Visit a Samurai's palace
10.  Catch a marlin
11.  Place in a hunting competition
12.  Learn to fly fish
13.  Skydive (not tandem)
14.  Light a cigarette with a 100 dollar bill
15.  Sail from NY to the Caribbean and back
16.  Place in a snowboarding competition
17.  Ride across the country on 64
18.  Own a 1964 Mustang Convertible
19.  Own the Mustang in Gone in 60 Seconds
20.  Compete and complete Dakar
21.  Ride a horse in Mongolia
22.  Canoe down the Colorado River through the Grand Canyon
23.  See the Forbidden City
24.  Own a house on a hill with a wrap around porch in Georgia
25.  Learn how to BBQ Eastern North Carolina style
26.  Record an album
27.  Eat a burger and some lemonade off the Santa Monica Pier
28.  Get drunk in Tokyo
29.  Eat something in Osaka

Monday, April 7, 2014

AWS Commands

Logging In:

ssh -i my-key-pair.pem ec2-user@ec2-198-51-100-1.compute-1.amazonaws.com

Starting MySQL Server:
sudo service mysqld start

Stopping MySQL Server:
sudo service mysqld stop

Location of cgi-bin:  /var/www/cgi-bin

Setting Up AWS

https://www.youtube.com/watch?v=ZAB8wCg9MyE&list=WLTIhhyxSVdGrvQ1JQhtmafO_FbsKmcoTH
(6:30)
(10:37 -- logging in with a mac)

https://www.youtube.com/watch?v=hJRSti6DsJg&list=WLTIhhyxSVdGrvQ1JQhtmafO_FbsKmcoTH
(0:00 - 8:11) useful

Migrating a DB from an EC2 and migrating it and using an RDS instance
https://www.youtube.com/watch?v=m2tpowIPA0s

Friday, April 4, 2014

iOS: Setting a specific NSDate

NSDateComponents *comps = [[[NSDateComponents alloc] init] autorelease];
[comps setDay:10];
[comps setMonth:10];
[comps setYear:2010];
self.timestamp = [[NSCalendar currentCalendar] dateFromComponents:comps];


http://stackoverflow.com/questions/2579738/iphone-os-how-do-i-create-an-nsdate-for-a-specific-date

Wednesday, April 2, 2014

Implementing a UIActivityIndicatorView (spinner) -- iOS

Place this in the .h file

// inside the interface

IBOutlet UIActivityIndicatorView *activityIndicator;

// outside the interface
@property (nonatomic, assign) UIActivityIndicatorView *activityIndicator;

Place in this .m file

in the synthesize section

@synthesize activityIndicator;

// inside viewDidLoad

-(void) viewDidLoad
{
...

    self.activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
    
    [self.view addSubview:self.activityIndicator];
    
    self.activityIndicator.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2);

    activityIndicator.hidden = YES;

}

// inside the place to activate the spinner

[self.activityIndicator startAnimating];

// inside the place to stop the spinner
[self.activityIndicator stopAnimating];

Navigating View Controllers Backward

-(void) pushLogOutViewController
{
    
    NSArray *viewControllers = [[self navigationController] viewControllers];
    for( int i=0;i<[viewControllers count];i++){
        id obj=[viewControllers objectAtIndex:i];
        if([obj isKindOfClass:[LoginViewController class]]){
            [[self navigationController] popToViewController:obj animated:YES];
            return;
        }
    }
    
    

}

Tuesday, April 1, 2014

Reading and Writing Values to a PList

Writing Values to a Plist:

-(int) saveBillingInformation:(NSString *)creditCardNumber setCCVNumber:(NSString*) ccvNumber setExpirationDate:(NSString*) expirationDate
{
   
    
    NSError *error;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //1
    NSString *documentsDirectory = [paths objectAtIndex:0]; //2
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"data.plist"]; //3
    
    NSFileManager *fileManager = [NSFileManager defaultManager];
    
    if (![fileManager fileExistsAtPath: path]) //4
    {
        // 5
        NSString *bundle = [[NSBundle mainBundle] pathForResource:@"ccinfo" ofType:@"plist"];
        
        [fileManager copyItemAtPath:bundle toPath: path error:&error]; //6
    }
    
    NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
    
    //here add elements to data file and write data to file
    
    [data setObject:creditCardNumber forKey:@"creditCardNumber"];
    
    [data setObject:ccvNumber forKey:@"ccvCode"];

    [data setObject:expirationDate forKey:@"expirationDate"];
    
    [data writeToFile: path atomically:YES];
    
    return 1;
    

}

Reading a Value to a Plist:


-(NSMutableDictionary *) getPListBillingInfo
{
    
    NSError *error;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); //1
    NSString *documentsDirectory = [paths objectAtIndex:0]; //2
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"data.plist"]; //3
    
    NSFileManager *fileManager = [NSFileManager defaultManager];
    
    if (![fileManager fileExistsAtPath: path]) //4
    {
        // 5
        NSString *bundle = [[NSBundle mainBundle] pathForResource:@"ccinfo" ofType:@"plist"];
        
        [fileManager copyItemAtPath:bundle toPath: path error:&error]; //6
    }
    
    NSMutableDictionary *creditCardInfoDict = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
    
    //load from savedStock example int value

    return creditCardInfoDict;

    // get the values from the NSMutableDictionary object
    

}