2008年6月27日 星期五

find command

ex:
find  .   -name  "test.c"
first argument set the path to find
second argument set the file to find

2008年6月25日 星期三

build java project from eclipse in xcode

prepare:
change Java template in Xcode
edit  /Developer/Library/Xcode/Project Templates/Java/Java Applicationex/build.xml
       source="1.5"  target="1.5"

(1)check out project "Test" from cvs
(2)create the Java project named "Test"
(3)now xcode create build.xml to compile your Java project 

include external jars
place jars in   Test/lib/

set main function:
in Info.plist,  set value = packageName.className  for key = MainClass
in Manifest,  set  Main-Class: packageName.MainClass

set image files:
place them in Test/bin

set VMOptions
in info.plist,  set  "-Xmx512m"  for key  "VMOptions"

set class path for app:
In Info.plist, set the value of  ClassPath
ex:

<key>ClassPath</key>

<array>

<string>$JAVAROOT/test1.jar</string>

<string>$JAVAROOT/test2.jar</string>

</array>


not including other jars when creating jar
comment  zipgroupfileset refid="lib.jars"

when the resource is the same location as execution file, how to set resource:
1. if execution file is jar(in jars/) , put resource in jars/ and use "java -jar" to run program
2. if execution file is App(in dist/), put resource in dist/  and run from xcode
3. place them in the bin/packageName/  


2008年6月24日 星期二

define macro in xcode

ex:
configuration: Debug
gcc 4.0 processing-> preprocessor macros:   _DEBUG

memory management in objective-c

retain:
increase retain count

release:
decrease retain count

array:
when an object is added to the array, the object's retain count is increased
when the array is deallocated,  the object( in array) 's retain count is decreased 

dealloc:
when an object's retain count becomes 0, its dealloc method is called

autorelease:
the object is added to autorelease pool when it is sent message autorelease
when the pool is drained, it sends message release to all objects in the pool

objects created by alloc, new, copy or mutableCopy have a retain count of 1 & are not in the autorelease pool 

if the object is get from other method, it is usually in the autorelease pool. If you do not want it to be deallocated when the pool drain, you must retain it

memory control for setter:
retain , then release
ex:
-(void)setName:(NSString*)name
{
      [name retain];
      [myName release];
      myName= name;
}

2008年6月23日 星期一

2008年6月18日 星期三

fileMerge

the GUI software to compare two files

compare two files
the two files compared are on the two top windows

use action to create merged file
the merged file is on the bottom window
(1) do action
(2) save file

diff

-w: ignore all whitespace

-q: Output only whether files differ