Monday, October 25, 2010

How many Objective-C Jobs in North American today?

Answer: 1197 (Note: They may have duplications depends on the HR posting.)
Date: Oct. 25, 2010

Also Recommand 2 Nice Apple Office Documents:
http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/CocoaFundamentals/CocoaFundamentals.pdf
Level: Mid to Adv Level
http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/A_Tour_of_Xcode/A_Tour_of_Xcode.pdf
Level: Beginner

And Link to SourceCode for a Cookbook I bought
----------------------------------------------
http://github.com/erica/iphone-3.0-cookbook-/
Level: Beginner to Mid

Friday, October 22, 2010

Useful Weblink to Learn Apple Programming

Mac OS X developer community
http://www.cocoadev.com/
Tutorial:
http://www.cocoadev.com/index.pl?RecentTutorials
• NSTableViewTutorial - Getting started with NSTableView
• ClassClusters - How to make your own class cluster 
• WorkerThread - A simple way to keep your user interface responsive while processing a lot of data 
• NSZone - How zoning works in Cocoa, what good it is, and how to support it 
• AnotherNSTableViewTutorial - Another NSTableView Tutorial
• SubFrameworksInXCode - Encapsulating and sharing code 
• NSToolbarTutorial
• RubyCocoaTutorial 
• XcodeGcovTutorial 

Others
• http://cocoakids.net/ Sweet bits of cocoa programming
• http://cocoasamurai.blogspot.com/ Various Cocoa Tutorials and tips
• http://clanmills.com/articles/cocoatutorials/ Cocoa Tutorials
• http://dbachrach.com/blog/2005/11/28/program-global-hotkeys-in-cocoa-easily/ A full tutorial on how to make Global Hotkeys for your Cocoa Applications.
• http://www.stepwise.com/Articles/HTMLEditorX/ (obsolete link) HTMLEditorX - A new beginning.
• http://www.stone.com/The_Cocoa_Files/ The Cocoa Files, by AndrewStone
• http://www.stepwise.com/Articles/VermontRecipes/ (obsolete link) Vermont Recipes, a Cocoa cookbook, hosted by StepWise.
• http://www.cocoadevcentral.com/ Various practical Cocoa tutorials.
• http://www.oreillynet.com/pub/ct/37 Programming With Cocoa series of tutorials aimed at the newbie.
• http://www.macresearch.org/cocoa_for_scientists Constantly evolving series covering Cocoa from a scientist's point-of-view. Also interesting for non-scientists.
• http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/objctutorial.pdf Currency Converter tutorial in Objective-C
• http://developer.apple.com/techpubs/macosx/Cocoa/JavaTutorial/javatutorial.pdf Temperature Converter tutorial in Java
• http://devworld.apple.com/technotes/tn/tn2005.html Apple sample Cocoa app technote
• http://thelittleappfactory.com/developer/ (obsolete link) Some quick example code and some fun toys.
• http://homepage.mac.com/mmalc/CocoaExamples/controllers.html Cocoa Bindings Examples and Hints.
• http://www.nancesoftware.com/development/sample_code/ Some intro drawing samples, Game Of Life, NSSegmentedControl, and LineBreakByTruncating?.
• http://www.cocoalab.com/?q=labnotes A simple bindings tutorial
• http://www.otierney.net/objective-c.html An tutorial that focuses on the language features unique to Objective-C
• http://www.scottydelicious.com/blog/cocoa_xmlrpc.html An in depth tutorial creating a Cocoa application to connect to a XML-RPC server.
• http://www.mere-mortal-software.com/blog/details.php?d=2007-01-08 NSWindow and NSView Backgrounds Tutorial
• http://www.cocoalab.com/?q=becomeanxcoder An introductory book on Objective-C and Cocoa

Learn from Real Codes (iPhone Pictures)

A Real Example: (Can you guess it?)

NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
[image setScalesWhenResized:YES];
[image setSize:NSMakeSize(1000.0, [image size].height * (1000.0/[image size].width))];
//set to high qualify
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
//Tune ant...
[[NSGraphicsContext currentContext] setShouldAntialias:YES];
NSImage *canvas = [[NSImage alloc] initWithSize:canvasSize];
[canvas lockFocus];

//Draw things here.

[canvas unlockFocus];
int border = 56;

NSRect rect = NSMakeRect(border/2, border/2, canvasSize.width - border, canvasSize.height - border);
[originImage drawInRect:rect
 fromRect:NSZeroRect
 operation:NSCompositeSourceOver
 fraction:1.0];

border -= 6;
[[NSColor whiteColor] set];
NSRect whiteBorderRect = NSMakeRect(border/2, border/2,
 canvasSize.width - border, canvasSize.height - border);
NSBezierPath *whiteBorder = [NSBezierPath bezierPathWithRect:whiteBorderRect];
[whiteBorder setLineJoinStyle:NSRoundLineJoinStyle];
[whiteBorder setLineWidth:2];
[whiteBorder stroke];
NSData *imageData = [NSData dataWithContentsOfFile:imagePath];
CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)imageData, NULL);

NSDictionary *metaData = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
NSDictionary *exifData = [metaData objectForKey:@"{Exif}"];
NSDictionary *tiffData = [metaData objectForKey:@"{TIFF}"];

NSData *imageData = [NSData dataWithContentsOfFile:imagePath];
CGImageSourceRef source = CGImageSourceCreateWithData((CFDataRef)imageData, NULL);

NSDictionary *metaData = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
NSDictionary *exifData = [metaData objectForKey:@"{Exif}"];
NSDictionary *tiffData = [metaData objectForKey:@"{TIFF}"];

//read-in pictures

[metaData release];
CFRelease(source);

Friday, October 22, 2010First Thing to Learn Objective C [2]

First, MVC, easlier to expend and maintenance!
If you know Java/J2EE, or .Net, you will know MVC is very important in the Software Applications.!
Model (Data), View (GUI), and C(Control with business Logic).
In Apple world, MFC are great!
Key-Value Coding(KVC)?Key-Value Observing(KVO)?Key-Value Binding(KVB)

Memory Management and Container
In Core libarary, Foundation Framework: including memory management, object management, container
Message Dispatching:
In Objective-C, using counter to manage the instance of jobs, before 2.0 version, programmer has to manually control the memory like in C, later adding new Garbage Collection Strtegies

Look at following codes:
NSString *aString = [[NSString alloc] initWithString:@"This is a demo."];
[aString release];
aString = nil;
--better do it all the time!!
- (NSString)demoString
{
NSString *result = [[NSString alloc] initWithString:@"This is a demo."];
[result autorelease];
return result;
}

ContainerListed here are most important and useful container, some developers love, but sometime give you some trouble as well.
There are 2 types: read-only or read-writable!

NSString
NSIndexSet
Any-type can save!!
NSArray
NSDictionary
NSSet
NSString *aString = [NSString stringWithString:@"This is a demo."];
NSNumber *aNumber = [NSNumber numberWithInteger:0];
NSArray *anArray = [[NSArray alloc] initWithObjects:aString, aNumber, nil];
Modifiable?? or Not?
NSMutableString, NSMutableArray, NSMutableDictioanry, NSMutableSet, NSMutableIndexSet
NSString *aString = [NSString stringWithString:@"This is a demo."];
NSNumber *aNumber = [NSNumber numberWithInteger:0];
NSMutableArray *aMutableArray = [NSMutableArray array];
[aMutableArray addObject:aString];
[aMutableArray addObject:aNumber];
[aMutableArray removeObjectAtIndex:0];
[aMutableArray removeAllObjects];

First Thing to Learn Objective C [1]

Topic: Devevlop Language, Tools and Environment and Simple Important Things
Language: Objective-C, cames from c and smalltalk
Cocoa: Like STL in C++, Swing in Java,
XCode: Like VisualStudio or Eclipse IDE
Interface Builder: << WYDWYS

Recommand Book:Programming in Objective-C" by Stephen Kochan
Beginning iPhone 3 Development: Exploring the iPhone SDK" By Jeff LaMarche and David Mark

Target: Practise and to Earn Money with your hard work!
FreeLance http://www.ifreelance.com/Freelancers/Freelance-Apple-Programmers/

Step1: Basic Concept 1 (Must to know) Quickly go-through it, learn from everywhere, here is only list some key points
All public
-+:  function, method, start
: means passed-in parameter!

Compare with Java code: private void hello(bool ishello)
{ //OOXX }
In Objective-C:
-(void) hello:(BOOL)ishello
{ //OOXX }

In my words: +: Means statics member of class
[] means what?  For example: [self hello:YES];   --> this.hello(true);

Your will see NS in everywhere in the objects name? Why? Because NS means NextStep??? Job's previous company name...
[My Notes: What's your next step?]

Hear are examples, which you are using every minutes and every seconds.
NSLog
NSString
NSInteger
NSURL
NSImage
Statement Example:NSLog (@"%d",myInt);
@: NSString using by NSLOG

CFStringTokenizer : Core Foundation
CALayer : Core Animation
CGPoint : Core Graphics
UIImage : iPhone picture
Here interface is Class(in Java/C++),
@interface:
In kids.h
@interface Kids: NSObject {
NSString *kidName;
NSString *kidAge;
}
-(BOOL) isCaughtKid:;
@end

kids.m (implementation!)
#import “kids.h”
@implementation Kids
-(void) init {
  kidName=@”mykid”; 
  kidAge=@”15”;
}
-(BOOL) isCaughtKid:{
   return YES;
}
@end

Case in Pass-in Many Parameters-(void) setKids: (NSString *)myOldestKidName secondKid: (NSString *) mySecondOldestKidName thirdKid: (NSString *) myThirdOldestKidName;
-(void) setKids:
(NSString *)myOldestKidName secondKid:
(NSString *) mySecondOldestKidName thirdKid:
(NSString *) myThirdOldestKidName{
son1 = myOldestKidName;
Son2 = mySecondOldestKidName;
Son3 = myThirdOldestKidName;
}
When you call:
Kids *myKids = [[Kids alloc] init];
[myKids setKids: @”SonName1” secondKid: @”SonName2” thirdKid: @”SonName3”];
testing:[[[MyClass alloc] init:[foo bar]] autorelease];
--> MyClass.alloc().init(foo.bar()).autorelease();

Others Powerful Points:id: data type as ANY, everything save as point, id give the address of WHATEVER...
NSArray: can save anything type of data
myArray <—-|
0: (float) 234.33f
1: @”I'm good.”
2: (NSImage *) (MyPic.jpg)
3: @”My adress is”
BOOL(YES,NO), (1, 0)
IBOutlet, IBAction
IB: Interface Builder, outlet: add it at front when you want see from outlet
Action:
nil: null pointer
@: convert to NSString, NSLog need,

Real Example of Helloworld:
import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSLog(@"Hello, World!");
    [pool drain];
    return 0;
}
My Note: Can you understand it now?...Congradulation!!