Wednesday, February 23, 2011

Oracle OTN Java Developer Guangzhou 2011

Jave SE7 SE8 New Features

Project Coin
- Generic Type Inference
- Multi-Catch
- Auto Resource Management (ARM) for streams
- Strings in Switch statement

Project Lambda
- Closure for Java (like Blocks in Mac OS)
- Lambda Expression


Wednesday, February 16, 2011

Unparsed aapt error, main.out.xml

click Run button in Eclipse when I am working in a resource file such as main.xml.
I got error running the project.
a blank xml file "main.out.xml" showed up in editor with message "The document is empty".
In console, "No embedded stylesheet instruction for file".


Wednesday, January 26, 2011

Not enough frames in stack, framework unavailable

Error Message: "mi_cmd_stack_list_frames: Not enough frames in stack"
when debugging on a lower-version iOS device.

To solve this problem, go to menu "Project"-> target info ->

Thursday, January 06, 2011

Create Android sample project, Invalid project description

I found that android sample codes are not Eclipse projects. You have to create Eclipse projects from the sample codes by choosing "Create project from existing sample."

DO NOT set the sample code directory as your workspace, otherwise an error dialog will popup saying something like "Invalid project description, NotePad overlaps the location of another project: 'NotePad'"

Let's build the sample codes and run as Android application.

Monday, January 03, 2011

NSDateFormatter setDateFormat YYYY return wrong year

On the first day of 2011, I found that the date formatter return a wrong year.
2011-01-01 is converted ot "2010年01月01日"
while 2011-01-02 ,2011-01-03 is converted correctly.

It's because the format string YYYY represent the "Year (of "Week of Year"), used in ISO year-week calendar. May differ from calendar year."


Monday, December 13, 2010

NSDateFormatter:Convert NSDate to NSString description

Convert a NSDate to string in format "yyyy-MM-dd"

NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *dateString = [dateFormatter stringFromDate:[NSDate date]];
NSLog(dateString);

Saturday, December 11, 2010

iPhone Simulator (IndigoDevice) Internal Error

I got a strange "Internal Error" when building app with Xcode. Restarting Xcode and my Mac do not help. Finally, I found the solution from JPoz:
http://blog.jpoz.net/2009/05/24/iPhone-simulator-internal-error.html
"go into your (username)/Library/Application Support/ and delete the iPhone Simulator folder. Restart xcode and build your app."
It works fine and help a lot.

Thursday, November 25, 2010

Invisible UIActivityIndicatorView loading activity indicator on iPhone4

I found that a UIActivityIndicatorView is invisible on iphone4 while it's working fine on simulator or earlier iphone version. And it's because "UIActivityIndicatorViewStyleWhiteLarge" is invisible on white background on iphone4. After change style to "UIActivityIndicatorViewStyleGray", it shows up but no "large" option.

Tuesday, November 23, 2010

Push Notification:iPhone deviceToken convert to NSString

Here's how to convert the (NSData *)deviceToken to (NSString *):
NSString *deviceTokenString = [[deviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
// also remove the space
deviceTokenString = [deviceTokenString stringByReplacingOccurrencesOfString:@" " withString:@""];

Monday, June 29, 2009

Using SoundEngine from apple

Sound Engine 2.0.3 from
http://stormyprods.com/SoundEngine/

Barebones Usage Example

#import 

UInt32     bangSound;