Wednesday 2-4, KH 105
COMP 446 / ELEC 446Mobile Wireless Services Project
Scott CutlerProfessor in the Practice of Computer TechnologyDepartment of Computer ScienceDepartment of Electrical and Computer [email protected] Day 9/09/09
COMP 446 / ELEC 446 - Week 3 2
Today’s Agenda Events of the week Announcements / Infrastructure Updates Apple Speak Last Week’s assignments Next Week
Assignments 2a and 2b due by 9/16/2009
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 3
Events of the Week Apple Beatle’s Day Announcement Intel brings faster CPUs to the maintream Nokia unveils N97 Mini iPhone will get MMS September 25 T-Mobile unveils pay-as-you-go Android phone Apple Store Robbery Took 31 Seconds Microsoft granted stay of Word injunction Windows Mobile 6.5 Will Debut on 3 LG Phones Zune HD Will Stand Alone in Battle with iPod
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 4
Current Roster Britt Antley
ELEC, GR, [email protected] Rohan Balsaver
ELEC, GR, [email protected] Chris Boyd
IT, [email protected] Hailey Hinson
IT, [email protected] Skyler Johnson
COMP, JR, Jones, [email protected] Sandhya Pai
ELEC, GR, [email protected] Rick Song
SS, Duncan, [email protected] Yiming Wang
ELEC, GR, [email protected]
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 5
COMP 446 Syllabus 8/26/09 Introduction / What makes mobile apps special
Assignment: Load Visual Studio – Due 9/2/09
9/2/09 Intro to Mac OS X and Cocoa Touch, Objective-C, Dev ToolsUsing Objective-C, Foundation framework
Videos: Skim: Lecture 1 (Intro to Mac OS X and Cocoa Touch, Objective-C, Dev Tools)
Skim: Lecture 2 (Using Objective-C, Foundation framework) Assignment: Hello Rice [1a] and WhatATool 1 [1b] (Due Beatles’ Day)
Beatles’ Day Discussion of first applications Videos: Lecture 3 (Custom classes, Memory Management, ObjC Properties)
Lecture 3a (Intro to XCode and Debugging – pdf only, no video)Lecture 4 (Interface Builder, Controls, Target-Action)
Assignment: WhatATool 2 [2a] and HelloPoly I [2b] (Due 9/16/09)
9/16/09 ASP.Net Videos: Lecture 5 (Views and Drawing, Animations)
Lecture 6 (View Controllers Basics) Assignment: HelloPoly II [3] (Due 9/23/09)
9/23/09 Creating and Consuming Web Services Videos: Lecture 7 (Navigation Controllers) / Lecture 8 (Table Views) Assignment: Presence 1 (Due 9/30/09)
9/30/09 Stanford Final Presentations Videos: Lecture 9 (Dealing with Data: User Defaults, SQLite, Web Services)
Lecture 10 (Threading, Caching and Memory) Assignment: Presence 2 (Due 10/07/09)
10/7/09 SQL 101 Videos: Lecture 11 (Text Input, Responder Chain, Presenting Content Modally)
Lecture 12 (Address Book) Assignment: SQL Query (Due 10/14/09)
10/14/09 Browser Capabilities Videos: Lecture 13 (Searching, Notifications) / Lecture 14 (Mulittouch) Assignment: Website Leveraging Browser Capabilities (Due 10/21/09)
10/21/09 iPhone Web Apps Videos: Lecture 15 (Device APIS: Image Picker, Core Location, Accelerometer, Battery
Life)Lecture 16 (Bonjour, Streams, Networking)
Assignment: iPhone Web Site (Due 10/28/09)
10/28/09 Optimizing OpenGL for iPhone (Video 15a) Videos: Lecture 17 (Audio, Video, Web Views)
Lecture 18 (Unit testing, Objective-C fun, Internationalization)
Assignment: SDK 3.0 Feature (Due 11/04/09)
11/4/09 Final Project Prep Videos: Lecture 9a (Loren Bricher on Tweetie)
Lecture 11a (How to Build an iPhone App that Doesn’t Suck)Assignment: Final Project (Due 12/2/2009)
11/11/09 Final Project Prep Videos: Lecture 13a (From Upstart to Startup to Grownup)
Lecture 7a (Publishing to the App Store – PDF only) Assignment: Final Project (Due 12/2/2009)
11/18/09 Final Project Prep Assignment: Final Project (Due 12/2/2009)
11/25/09 Thanksgiving – Continue Final Projects on your own
12/2/09 Demonstrate Final Projects
12/6/09 Class Offsite – Sunday (tentative)SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 6
Mechanics Course Website: http://comp446.rice.edu Course Share: \\comp446.rice.edu\comp446 Website Development using Visual Studio Invitation to Join iPhone Developer Program
Still pending for Skyler, Rohan, Hailey iPhone Development via Xcode and Interface Builder
All IT supported Macs have tools loaded Keep files on your shared drive or memory stick
iMac available via www.LogMeIn.com User ID [email protected] Mac Login: Comp446 Passwords given verbally in class
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 7
Course Web Server
http://www.comp446.com Hosted through www.DiscountASP.net
Login: comp446com0 (zero) Password: same as for other things
I will create individual websites for each student by 9/16/09 MS SQL Server 2008 also secured for class
Will pass out credentials during SQL class Let me know if you need earlier access
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 8
Apple Speak
Strong visions
Loyal followings
Internally consistent
Unique ways to describe standard concepts
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 9
Delegation Lecture 4 has long, confusing discussion on Delegates
Scott Cutler method to describe delegates Frameworks contain many classes Implementation of some classes either require or optionally allow
customization / user coding. Delegates are a set of methods primarily related to a system class
Required methods need to be written to complete class Optional methods have default actions that can be overridden by the
programmer.
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 10
Delegation Examples
applicationDidFinishLoading applicationWillTerminate // Required method
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
// Optional method, defaults to 1 if not implemented- (NSInteger)numberOfSectionsInTableView:(UITableView *)table;
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 11
Objective-C Terminology
; Every statement ends with a semicolon+ Refers to a method on a Class- Refers to a method on an instance of a Class{ } Groups Objective-C statements[ ] [object method OptionalArgs]() Casts an object as a certain Class, Also parameters for C
functions* Pointer to an object e.g. *stringVar (** = pointer to *???): Specifies an argument. Also used in definitionsSEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 12
Objective-C Terminology
@ Prefaces an NSString object or selector. Also many compiler directives (@Interface, @Implementation, @End
// Comments. Shortcut to get or set a property# Compiler Directives like #import! Not (as in !=)+= Standard C style arithmetic (Also ++, -=, etc)% typed placeholder in formatted strings== Identity compareSEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 13
Objective-C Naming
Case Matters!!! LastName is not the same as lastName
Tradition has identifiers and methods made of concatenated names with the first name in lower case and the remaining names with an uppercase first letter. Examples: lastName, openFile, initWithObjects Compiler will make some things easier when conventions are
followed.
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 14
iVars and Properties
Two concepts; often related and often confused iVars are the instance variables. Space is allocated from the
heap when instanced allocated. They are associated with that instance of the object (although they can be objects in the own right)
Properties are readable and/or writeable attributes of a class instance. They can be set to just set or get an iVar. They also can report or change aspects of the instance (e.g. canVote)
Often best to give properties different names from iVars due to visibility scope issues.
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 15
Last Week’s Assignment
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 16
Section 1 - Paths
SEC - Beatler Day
void PrintPathInfo(){NSLog(@"Section 1 - Paths");NSString *path=@"~";path = [path stringByExpandingTildeInPath];NSLog(@"My home folder is at '%@'",path);NSArray *pathComponents = [path pathComponents];for (NSString *pathElement in pathComponents){NSLog(@"%@", pathElement);}
}//PrintPathInfo
COMP 446 / ELEC 446 - Week 3 17
Section 2 - Processes
SEC - Beatler Day
void PrintProcessInfo(){NSLog(@"Section 2 - Processes");NSString *processName = [[NSProcessInfo processInfo] processName];int processID = [[NSProcessInfo processInfo] processIdentifier];NSLog(@"Process Name: '%@' Process ID: '%d'",processName, processID);
}//PrintProcessInfo
COMP 446 / ELEC 446 - Week 3 18
Section 3 - URLs
SEC - Beatler Day
void PrintBookmarkInfo(){NSLog(@"Section 3 - URLs");NSMutableDictionary *urlDictionary;urlDictionary= [NSMutableDictionary dictionary];[urlDictionary setObject: [NSURL URLWithString:@"http://www.stanford.edu"] forKey: @"Stanford
University"];[urlDictionary setObject: [NSURL URLWithString:@"http://www.apple.com"] forKey: @"Apple"];[urlDictionary setObject: [NSURL URLWithString:@"http://cs193p.stanford.edu"] forKey: @"CS193P"];[urlDictionary setObject: [NSURL URLWithString:@"http://itunes.stanford.edu"] forKey: @"Stanford on
iTunes U"];[urlDictionary setObject: [NSURL URLWithString:@"http://stanfordshop.com"] forKey: @"Stanford
Mall"];for (id key in urlDictionary) {
if ([key hasPrefix:@"Stanford"]) {NSLog(@"key: %@, value: %@", key, [urlDictionary objectForKey:key]);
}}
}//PrintBookmarkInfo
COMP 446 / ELEC 446 - Week 3 19
Section 4 – Introspection (creation)
SEC - Beatler Day
void PrintIntrospectionInfo(){NSLog(@"Section 4 - Introspection");NSMutableArray *randomArray;randomArray = [NSMutableArray arrayWithCapacity:8];[randomArray insertObject: [[NSProcessInfo processInfo] processName] atIndex:0];[randomArray insertObject:[NSURL URLWithString:@"http://www.stanford.edu"] atIndex:1];[randomArray insertObject:[NSString localizedStringWithFormat:@"%@: %f\n", @"Cost", 1234.56]
atIndex:2];NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil];NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil];NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];[randomArray insertObject:dictionary atIndex:3];NSMutableString *muString = @"mutable string1";[randomArray insertObject:muString atIndex:4];NSString *nonMustring=@"Plain String";[randomArray insertObject:nonMustring atIndex:5];[randomArray insertObject:[NSMutableDictionary dictionaryWithCapacity:6] atIndex:6];[randomArray insertObject:[NSMutableString stringWithCapacity:7] atIndex:7];[[randomArray objectAtIndex:7] appendString: @"Help"];
COMP 446 / ELEC 446 - Week 3 20
Section 4 – Introspection (inspect)
SEC - Beatler Day
for (NSObject *arrayObject in randomArray){
NSLog(@"Class name: %@",[[arrayObject class] description]);NSLog(@"Is Member of NSString: %@",[arrayObject isMemberOfClass:[NSString class]] ? @"YES" :
@"NO");NSLog(@"Is Kind of NSString: %@",[arrayObject isKindOfClass:[NSString class]] ? @"YES" : @"NO");if ([arrayObject respondsToSelector:@selector(lowercaseString)]){
NSLog(@"Responds to lowercaseString: Yes");NSLog(@"lowercaseString is : %@",[[arrayObject description] lowercaseString ]);
}else{NSLog(@"Responds to lowercaseString: No");
}NSLog(@"====================================");
}} //PrintIntrospectionInfo
COMP 446 / ELEC 446 - Week 3 22
Final Project To be determined by end of 9th week
Topic chosen shortly after mid semester break (10/21/09) Spec finished by 11/04/09 This is VERY important. If we do not have a great project definition, the
most interesting part of the course will suffer. With a great project, this will be an exciting course.
Can be done individually or in pairs
Great if your project could have life after the class finishes
SEC - Beatler Day
COMP 446 / ELEC 446 - Week 3 23
Week 4 Assignments
View CS193P Lectures 3 and 4 Slides Available for CS193P debugging lecture (Section-1-XCodeDebugging + exercises)
Download and complete CS193P Assignments 2a and 2b 2a – Add a Polygon model to your What-A-Tool project 2b – First part of your HelloPolly iPhone Application Use 2b Walkthrough to complete assignment 2b Contact me BEFORE Tuesday if you request my assistance.
Complete assignments before next class (9/16/2009)) Note: On LogMeIn, Control Drag does not work as if you were local
Introduction to ASP.Net:
Future Feel free to get ahead of plan with videos and published assignments
Workload will get harder with each assignment. We will follow CS193P assignments up to and including Presence 2
Start thinking about big project Really – start thinking about big project!
SEC - Beatler Day