Friday, August 26, 2011

From NSData to CFDataRef


NSData *imageData = UIImagePNGRepresentation(originalImage);
CFDataRef cfdata = CFDataCreate(NULL, [imageData bytes], [imageData length]);

Friday, July 1, 2011

How to set new object properly in objective C

create new object without memory leak.


AnyObject *myObject = [[AnyObject alloc] init]; 
something.property = myObject;
[myObject release]; // no leaks!

Wednesday, June 1, 2011

Bit & Byte difference

For sign digit ]]]]]]]]]]......  -2ˆ(n-1) <<<<<<<>>>>>>>2ˆ(n-1)-1
For unSign digit ]]]]]]......  0<<<<<<<<<<<>>>>>>>>2ˆn-1;
for n dighit divide circle for 2ˆn parts..

Monday, May 30, 2011

Objective C date comparision

if (licenseDictionary == nil){
     return @"Not Registered"; 
}else if([today compare:expDate] == NSOrderedAscending) {
     [gotoButton setEnabled:YES]; return [licenseDictionary objectForKey:@"Name"]; 
} else{
     return @"License Expired";
}

Wednesday, May 25, 2011

Convert sound through Mac terminal

You may use the afconvert tool to convert sounds. For example, to convert the 16-bit linear PCM system sound Submarine.aiff to IMA4 audio in a CAF file, use the following command in the Terminal application:

afconvert /System/Library/Sounds/Submarine.aiff ~/Desktop/sub.caf -d ima4 -f caff -v


You can inspect a sound to determine its data format by opening it in QuickTime Player and choosing Show Movie Inspector from the Movie menu.
Custom sounds must be under 30 seconds when played. if a custom sound is over that limit, the default system sound is played instead.


iPhone support sound formats are
Linear PCM, MA4 (IMA/ADPCM), uLaw or aLaw wAy...

How multitasking works on iPhone

Here is an interesting article about how multitasking works on iPhone

http://gizmodo.com/5512656/how-multitasking-works-in-the-new-iphone-os-40