This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Set cookie policy to accept cookies always | |
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; | |
[cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to poll the server periodically | |
- (BOOL)testForFlakServer:(NSString *)hostURL { | |
NSString *urlString = [NSString stringWithFormat:@"%@/flak", hostURL]; | |
NSLog(@"urlString: %@", urlString); | |
NSURL *url = [NSURL URLWithString:urlString]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:url]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to create a POST request to the Flak server | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; | |
[request setHTTPMethod:@"POST"]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; | |
NSData *data = [jsonStringForSession dataUsingEncoding:NSISOLatin2StringEncoding]; | |
[request setHTTPBody:data]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handling Flak dates | |
NSDateFormatter* dateFormatter; | |
... | |
@property (nonatomic, retain) NSDateFormatter *dateFormatter; | |
//In the init method of something | |
self.dateFormatter = [[NSDateFormatter alloc] init]; | |
self.dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss'Z'"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Searching An Array | |
1. A for loop that loops through the array | |
for (index = 0; index < numbers.length; index++) { | |
2. An "if" statement that compare the current element in the array with the value I'm searching for. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is the JavaScript code for | |
"Lab 11: Searching an Array" | |
File: /unit5/labs/lab11searchAnArray.html | |
*/ | |
function lab11Demo() { | |
// Your code goes in here. | |
var words; | |
var search = "not"; | |
var index; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Datasource array for table view | |
- (void)createDataSourceArray { | |
NSDictionary *credentials = [self.flakManager.settingsManager loginCredentials]; | |
NSDictionary *loginDictionary = [[NSDictionary alloc] initWithObjectsAndKeys: | |
@"Logged in as:", @"sectionTitle", | |
[NSArray arrayWithObjects: | |
[credentials objectForKey:@"currentLoggedInUserByName"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UNIX Commands | |
pwd - Where am I? | |
cd - Just type "cd" to go home | |
ls - basic directory list | |
ls -l - list view of directory | |
ls -a - show all files including hidden | |
ls -al - show all in list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Exception demo | |
package java112.labs1; | |
import java.io.*; | |
import java.util.*; | |
/** | |
* @author Eric Knapp | |
* class ExceptionDemo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Demo of IBOutlet | |
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | |
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
self.myFirstLabel.text = @"Fred"; | |
} |