Mar 19, 2010
(XCode) How to resolve "Warning: Multiple build commands for output file ..."
Just met a weird warning message in XCode which is "Warning: Multiple build commands for output file ..." after deleting a resource file, and i checked the file does not exist in resource folder any more, finally i found the the file did appear in "targets/app name/copy bundle resources/", than i figure out i accidentally pressed "Delete reference" when i delete the file, and that's why the resource file still exist in the "copy bundle resources" folder
Dec 29, 2009
(Objective-c)How to round a number
Here is a solution to round a float number:
or
Result: 3.142
NSString *pi = @"3.14159265";
int floatSize = 3;
NSDecimalNumber *numericValue = [NSDecimalNumber decimalNumberWithString:pi];
NSDecimalNumberHandler *roundingStyle = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:
NSRoundBankers scale:floatSize raiseOnExactness:NO raiseOnOverflow:NO raiseOnUnderflow:NO
raiseOnDivideByZero:NO];
NSDecimalNumber *roundedNumber = [numericValue decimalNumberByRoundingAccordingToBehavior:
roundingStyle];
or
NSString *pi = @"3.14159265";
NSString *roundedNumber = [[NSString alloc] initWithFormat:@"%.3f",[pi floatValue]];
Result: 3.142
Dec 7, 2009
(Eclipse)How to resolve "Initializing Java Tooling"
Just met an initialization error on Eclipse, the error message is:
'Initializing Java Tooling' has encountered a problem. An internal error occurred during: "Initializing Java Tooling".
It's really annoying, after googling several sites, here is a working solution:
Delete the following directory: WORKSPACE_HOME/.metadata/.plugins/org.eclipse.core.resources/.project, and restart Eclipse and problem should be solved.
'Initializing Java Tooling' has encountered a problem. An internal error occurred during: "Initializing Java Tooling".
It's really annoying, after googling several sites, here is a working solution:
Delete the following directory: WORKSPACE_HOME/.metadata/.plugins/org.eclipse.core.resources/.project, and restart Eclipse and problem should be solved.
Aug 19, 2009
(Other)The Google Online Marketing Challenge 2008 Campaign Results
I have chosen the course "E-Commerce" in my last semester in the Université de Montpellier 2. Dr. Jean-Yves Delort which is our professor organized 14 student teams participating to The Google Online Challenge 2008. I just get the rating of our team from Dr. Jean-Yves Delort's site. We are "Strong Campaign", it is such a good news, because marketing is not our major, and we really did a good job.
Dr. Jean-Yves Delort's site
2008 Campaign Results
Dr. Jean-Yves Delort's site
2008 Campaign Results
Jul 10, 2009
(Objective-c) How to get MD5 hash string of a NSData
- (NSString*)dataMD5:(NSData*)data {
CC_MD5_CTX md5;
CC_MD5_Init(&md5);
CC_MD5_Update(&md5, [data bytes], [data length]);
unsigned char digest[CC_MD5_DIGEST_LENGTH];
CC_MD5_Final(digest, &md5);
NSString* s = [NSString stringWithFormat: @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
digest[0], digest[1],
digest[2], digest[3],
digest[4], digest[5],
digest[6], digest[7],
digest[8], digest[9],
digest[10], digest[11],
digest[12], digest[13],
digest[14], digest[15]];
return [s uppercaseString];
}
Jul 7, 2009
Mar 24, 2009
(XCode) How to setup a bracket / brace macro in XCode
Before i used XCode and learned Objective-C, i never thought the bracket is a horrible symbol, there is a solution of creating text macro to insert bracket / brace:
1. Open ObjectiveC.xctxtmacro with an text editor, you can find this file with this path:
2.Add follow code in the file:
You can create a similar macro for Brace, here is an example:
Update: In the XCode 3.2 which is released for Snow Leopard, the above lines wouldn't work until add this line in each section:
OnlyAtBOL = YES;
1. Open ObjectiveC.xctxtmacro with an text editor, you can find this file with this path:
/Developer/Applications/Xcode.app/Contents/PlugIns/TextMacros.xctxtmacro/Contents/Resources/ObjectiveC.xctxtmacro 2.Add follow code in the file:
{
Identifier = objc.bracket;
BasedOn = objc;
IsMenuItem = YES;
Name = "Bracket Expression";
TextString = "[<#!expression!#>]";
CompletionPrefix = bra;
},This scope create a text macro "bra" to insert "[<#!expression!#>]", you need to type bra in your code and presse "esc" button, there is a window shows "Bracket Expression", press enter "[<#!expression!#>]" will be inserted.You can create a similar macro for Brace, here is an example:
{
Identifier = objc.brace;
BasedOn = objc;
IsMenuItem = YES;
Name = "Brace Expression";
TextString = "{<#!expression!#>}";
CompletionPrefix = bra;
},Here you have a same text macro "bra" to choose bracket or brace.Update: In the XCode 3.2 which is released for Snow Leopard, the above lines wouldn't work until add this line in each section:
OnlyAtBOL = YES;
Subscribe to:
Posts (Atom)