[IOS] image size

개발/iOS 2010. 11. 28. 01:23
tabbar image size 
- document 30 x 30 
- best size 48 x 32

icon.png 57 x 57

'개발 > iOS' 카테고리의 다른 글

[iOS] UITableView Cell 변경 animation  (0) 2011.04.29
[IOS] KEYBOARD 화면 이동  (0) 2010.12.13
[XCODE] Breakpoint가 안먹을 때  (0) 2010.11.28
[XCODE] 메모리 관리 규칙  (0) 2010.11.16
[XCODE] Redefine NSLog  (0) 2010.11.16
Posted by 나랑살자
,
Pereferences - Debugging 탭에서 'Load symbols lazily' 옵션을 꺼주면 된다.

'개발 > iOS' 카테고리의 다른 글

[IOS] KEYBOARD 화면 이동  (0) 2010.12.13
[IOS] image size  (0) 2010.11.28
[XCODE] 메모리 관리 규칙  (0) 2010.11.16
[XCODE] Redefine NSLog  (0) 2010.11.16
[XCODE] DEBUGING 팁  (0) 2010.11.16
Posted by 나랑살자
,

[JAVA] DWR

개발/java 2010. 11. 23. 23:18
<!-- DWR Setting -->
<servlet>
   <servlet-name>dwr</servlet-name>
   <!-- display-name>DWR Servlet</display-name -->
   <!-- description>Direct Web Remoter Servlet</description -->
   <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
   <!-- This should NEVER be present in live -->
   <init-param>
     <param-name>debug</param-name>
     <param-value>true</param-value>
   </init-param>
   <!-- By default DWR creates application scope objects when they are first
   used. This creates them when the app-server is started -->
   <init-param>
     <param-name>initApplicationScopeCreatorsAtStartup</param-name>
     <param-value>true</param-value>
   </init-param>
   <!-- WARNING: allowing JSON-RPC connections bypasses much of the security
   protection that DWR gives you. Take this out if security is important -->
   <init-param>
     <param-name>jsonRpcEnabled</param-name>
     <param-value>true</param-value>
   </init-param>
   <!-- WARNING: allowing JSONP connections bypasses much of the security
   protection that DWR gives you. Take this out if security is important -->
   <init-param>
     <param-name>jsonpEnabled</param-name>
     <param-value>true</param-value>
   </init-param>
   <!-- data: URLs are good for small images, but are slower, and could OOM for
   larger images. Leave this out (or keep 'false') for anything but small images -->
   <init-param>
     <param-name>preferDataUrlSchema</param-name>
     <param-value>false</param-value>
   </init-param>
   <!-- This enables full streaming mode. It's probably better to leave this
   out if you are running across the Internet -->
   <init-param>
     <param-name>maxWaitAfterWrite</param-name>
     <param-value>-1</param-value>
   </init-param>
   <!--
   For more information on these parameters, see:
   - http://getahead.org/dwr/server/servlet
   - http://getahead.org/dwr/reverse-ajax/configuration
   -->
   <load-on-startup>1</load-on-startup>
  </servlet>
 
<servlet-mapping>
<servlet-name>dwr</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
Posted by 나랑살자
,

$ defaults write com.apple.Finder AppleShowAllFiles YES
$ defaults write com.apple.Finder AppleShowAllFiles NO
Posted by 나랑살자
,

규칙1]

 - alloc, copy, new 를 포함하는 메서드는 retain된 객체를 리턴한다. 

  이 리턴되는 객처는 retain되어 있기 때문에 반드시 release를 호출해야 한다.


규칙2]

 - 자신이 retain 호출했다면 반드시 release를호출해야 한다.


규칙3]

 - 클래스메서드가 객체를 생성해 줄 때는  autorelease 객체를 리턴한다.

   그렇기 때문에 별도의 release를 호출하지 않아도 오토릴리즈 풀이 자동으로 release를 호출한다.

  하지만, 이 객체에 대한 retain을 호출했다면 같은 횟수만큼 release를 호출해야 한다.

 

 예)

  NSString *pStr = [NSString stringWithString:@"Test"];


규칙4]

 - 배열, 딕셔너리 등의 자료구조 클래스는 추가된 객체를 retain하고, 항목을 제거할 때 release를 한다.

  NSArray, NSDictionary, NSSet등의 자료구조 클래스는 항목으로 추가되는 객체에 retain을 한 번 호출한다.

 그리고 객체가 포함 객체에서 제거될 때 release를 호출한다. 그렇기 때문에 별도의 retain을 해 줄 필요는 없다.


규칙5]

 - retain 속성을 갖는 접근자의 경우(@property (retain) ... ) 객체가 설정될 때 자동으로 retain 된다.

예) 

 myImage = [[UIImage alloc] init]; // myImage retain '1'

self.userImage = myImage; // myImage retain '2'

[myImage release]; // myImage retain '1'


...


self.userImage = myImage2; // myImage retain '0'


규칙 6]

- 메서드가 리턴하는 객체는 autorelease을 하고 리턴하도록 한다.

예)

- (NSString *) findTopPlayer{ 

NSString *ret = [[top objectAtIndex:0] copy];

[ret autorelease];

return ret;


규칙7]

 - IBOutlet으로 연결되는 객체는 retain 되어 있다. 따라서, 반드시 release를 호출해야 한다.


예)

IBOutlet UIButton *button;


....

- (void) dealloc{

[button release];

[super dealloc];

}



출처 : http://maluchi.cafe24.com/xe/MyProgrammingTips/17149

'개발 > iOS' 카테고리의 다른 글

[IOS] image size  (0) 2010.11.28
[XCODE] Breakpoint가 안먹을 때  (0) 2010.11.28
[XCODE] Redefine NSLog  (0) 2010.11.16
[XCODE] DEBUGING 팁  (0) 2010.11.16
[IOS] Core Data에서 SQLite 사용하기  (0) 2010.11.01
Posted by 나랑살자
,

[XCODE] Redefine NSLog

개발/iOS 2010. 11. 16. 17:51
x#ifdef DEBUG
    #define NSLog(fmt, ...) NSLog((@"%s[Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
    #define NSLog(...)
#endif

'개발 > iOS' 카테고리의 다른 글

[IOS] image size  (0) 2010.11.28
[XCODE] Breakpoint가 안먹을 때  (0) 2010.11.28
[XCODE] 메모리 관리 규칙  (0) 2010.11.16
[XCODE] DEBUGING 팁  (0) 2010.11.16
[IOS] Core Data에서 SQLite 사용하기  (0) 2010.11.01
Posted by 나랑살자
,

[XCODE] DEBUGING 팁

개발/iOS 2010. 11. 16. 17:48
요즘 Xcode를 만져보고 있는데, 어렵긴 어렵다. 스타일이라고 해야할지 접근 방식이라고 해야할지 모르겠지만 환경 자체가 너무나 이질적인지라 .. 쓰다보니 디버깅 관련된걸 메모해둬야 할 것 같아서 몇 가지 적어본다 (사실 요즘 보고 있는 책에 나오는 내용이긴 하지만;)


- 좀비 객체 만들기 ; 
객체를 미리 해제하는 코드에서 오류가 발생할 경우, 문제의 개체를 좀비 상태로 만들어 해제를 막고 객체의 상태를 체크할 수 있다. 이는 실행 파일 설정을 변경해야 하는데, Executable Info의 Arguments 탭에서 다음 환경 변수를 추가한다 :
NSZombieEnabled=YES
CFZombieLevel=16

- NSAssert 해제 ;
NSAssert의 검증을 막으려면 Project/Build Info의 Build 탭에서 설정을 추가하면 된다. GCC 4.0 - Preprocessing 하단의 Preprocessor Macros에 NS_BLOCK_ASSERTIONS를 정의하면 된다.
(어째서 이걸 '정의'해야 Assert의 검증을 'Block'하는건지... 이게 GCC 스타일인가?;)

- 예외 발생시 브레이크 포인트 걸기 ;
XCode에서는 디버깅 시 예외가 발생했을 때 자동으로 예외가 발생한 행에서 브레이크포인트가 걸리지 않는다. (그러니까 대체 왜!) Breakpoints 창을 열어서 objc_exception_throw 심볼릭 브레이크포인트를 추가해야 한다.
참고로 malloc_error_break는 alloc이 실패할 때 발생하는 듯 ... 하지만 왜 이건 애플 레퍼런스 라이브러리에도 안 나오는지가 미스테리. 뭐지?

'개발 > iOS' 카테고리의 다른 글

[IOS] image size  (0) 2010.11.28
[XCODE] Breakpoint가 안먹을 때  (0) 2010.11.28
[XCODE] 메모리 관리 규칙  (0) 2010.11.16
[XCODE] Redefine NSLog  (0) 2010.11.16
[IOS] Core Data에서 SQLite 사용하기  (0) 2010.11.01
Posted by 나랑살자
,
NFS 설치

RPM 명령어 이용 패키지 설치 확인

# rpm -qa | grep nfs
nfs-utils-1.0.6-70.EL4

# rpm -qa | grep portmap
portmap-4.0-63

yum으로 설치
# yum install portmap nfs-utils* libgssapi

rpm 으로 설치시

# wget http://mirror.oss.or.kr/pub/centos/4.4/os/i386/CentOS/RPMS/nfs-utils-lib-1.0.6-3.i386.rpm
# wget http://mirror.oss.or.kr/pub/centos/4.4/os/i386/CentOS/RPMS/libgssapi-0.8-1.i386.rpm
# rpm -Uvh *.rpm

 

NFS 서버 데몬 구동

# ntsysv
--NFS, portmap 자동 실행, iptables 방화벽을 체크 해제하고 nfs를 체크한다.

# /etc/rc.d/init.d/portmap start
portmap (을)를 시작합니다: [  확인  ]

# /etc/rc.d/init.d/nfs start
NFS 서비스를 시작하고 있습니다:  [  확인  ]
NFS 쿼터를 시작하고 있습니다: [  확인  ]
NFS 데몬을 시작함: [  확인  ]
NFS mountd를 시작하고 있습니다: [  확인  ]

NFS 서버의 공유목록을 관리하는 파일
# vi /etc/exports

-공유디렉토리 접근할 호스트(옵션)

예) /home/www 192.168.1.1(rw,sync)
-> 192.168.1.1 호스트의 접속 허용

예)/home/www 192.168.1.0/255.255.255.0(rw,sync)
-> 192.168.1.* 호스트의 접속 허용

설정 옵션
rw : 읽기, 쓰기 가능
ro : 읽기만 가능
secure : 클라이언트 마운트 요청시 포트를 1024 이하로 한다.
noaccess : 액세스 거부
root_squach : 클라이언트의 root가 서버의 root권한을 획득하는 것을 막는다
no_root_squash : 클라이언트의 root와 서버의 root를 동일하게 한다
sync : 파일 시스템이 변경되면 즉시 동기화한다.
all_squach : root를 제외하고 서버와 클라이언트의 사용자를 동일한 권한으로 설정한다.
no_all_squach : root를 제외하고 서버와 클라이언트의 사용자들을 하나의 권한을 가지도록 설정한다. 





 

공유 디렉토리를 만든다
# mkdir data
# chomd 777 data

 
확인
# exportfs -v
/home/data      192.168.1.1(rw,wdelay,root_squash)
-나오지 않는다면 nfs 를 재가동 해보시길 바랍니다.
# /etc/rc.d/init.d/nfs restart

[exportfs 명령어 사용법]

exportfs 명령어는 nfs서버를 다시 시작하지 않고도 공유목록을 수정할 수 있다.
- a : /etc/exports파일을 읽어 들인다.
- r : /etc/exports파일을 다시 읽어 들인다.
- u IP:/디렉토리 : 입력한 디렉토리를 공유목록에서 제외한다.
- v : 현재의 공유 목록을 확인한다.

2. 클라이언트 서버
# mkdir /home/data

mount 명령어로 NFS 서버의 공유 디렉토리를 마운트 시킨다.

# mount -t nfs 192.168.1.1:/data /home/data

 

만약 마운트가 되지 않으면 방화벽 사용 중지 (서버쪽 클라이언트쪽모두)
# /etc/init.d/iptables stop

nfs 재가동(서버측)
# /etc/rc.d/init.d/nfs restart

마운트 확인
# cat /etc/mtab | grep /home/data
192.168.1.1:/home/data /home/data1 nfs rw,addr=192.168.1.1 0 0

 

# df -h
 Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2             6.8G  122M  6.3G   2% /
/dev/sda1              99M  8.5M   86M   9% /boot
none                  252M     0  252M   0% /dev/shm
/dev/sda8              54G   85M   52G   1% /home
/dev/sda7            1012M   34M  927M   4% /tmp
/dev/sda3             6.8G  919M  5.5G  15% /usr
/dev/sda5             3.9G   79M  3.6G   3% /var
192.168.1.1:/home/data
                       54G   85M   52G   1% /home/data1

부팅시 자동 마운트

# vi /etc/fstab

192.168.1.1:/home/data  /home/data              nfs     defaults        1 2

 

마운트 해제시
# umount /home/data

 

마운트가 안될때
마운트고 안될시 클라이언트 서버에도
NFS 설치 및 portmap 등 재가동 확인해보세요

'개발 > Linux' 카테고리의 다른 글

[LINUX] Subversion설치  (0) 2011.02.07
[LINUX] CentOS 5.5에 CMake 설치  (0) 2010.12.20
[LINUX] FIND AND REPLACE with SED  (0) 2010.12.13
[LINUX] HDD 복사  (0) 2010.10.28
[LINUX] TIME SYNC  (0) 2010.10.28
Posted by 나랑살자
,

vi /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini

showsplash org.eclipse.platform
--launcher.XXMaxPermSize 512m
-vmargs
-Xms40m
-Xmx512m
-XX:MaxPermSize=512m
-Xms40m
-Xmx512m

Posted by 나랑살자
,

12.5. iBATIS SQL Maps

The iBATIS support in the Spring Framework much resembles the JDBC / Hibernate support in that it supports the same template style programming and just as with JDBC or Hibernate, the iBATIS support works with Spring's exception hierarchy and let's you enjoy the all IoC features Spring has.

Transaction management can be handled through Spring's standard facilities. There are no special transaction strategies for iBATIS, as there is no special transactional resource involved other than a JDBCConnection. Hence, Spring's standard JDBC DataSourceTransactionManager orJtaTransactionManager are perfectly sufficient.

Note

Spring does actually support both iBatis 1.x and 2.x. However, only support for iBatis 2.x is actually shipped with the core Spring distribution. The iBatis 1.x support classes were moved to the Spring Modules project as of Spring 2.0, and you are directed there for documentation.

12.5.1. Setting up the SqlMapClient

If we want to map the previous Account class with iBATIS 2.x we need to create the following SQL map'Account.xml':

<sqlMap namespace="Account">

 

  <resultMap id="result" class="examples.Account">

    <result property="name" column="NAME" columnIndex="1"/>

    <result property="email" column="EMAIL" columnIndex="2"/>

  </resultMap>

 

  <select id="getAccountByEmail" resultMap="result">

    select ACCOUNT.NAME, ACCOUNT.EMAIL

    from ACCOUNT

    where ACCOUNT.EMAIL = #value#

  </select>

 

  <insert id="insertAccount">

    insert into ACCOUNT (NAME, EMAIL) values (#name#, #email#)

  </insert>

 

</sqlMap>

The configuration file for iBATIS 2 looks like this:

<sqlMapConfig>

 

  <sqlMap resource="example/Account.xml"/>

 

</sqlMapConfig>

Remember that iBATIS loads resources from the class path, so be sure to add the 'Account.xml' file to the class path.

We can use the SqlMapClientFactoryBean in the Spring container. Note that with iBATIS SQL Maps 2.x, the JDBC DataSource is usually specified on the SqlMapClientFactoryBean, which enables lazy loading.

<beans>

 

  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">

    <property name="driverClassName" value="${jdbc.driverClassName}"/>

    <property name="url" value="${jdbc.url}"/>

    <property name="username" value="${jdbc.username}"/>

    <property name="password" value="${jdbc.password}"/>

  </bean>

 

  <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">

    <property name="configLocation" value="WEB-INF/sqlmap-config.xml"/>

    <property name="dataSource" ref="dataSource"/>

  </bean>

 

</beans>

12.5.2. Using SqlMapClientTemplate and SqlMapClientDaoSupport

The SqlMapClientDaoSupport class offers a supporting class similar to the SqlMapDaoSupport. We extend it to implement our DAO:

public class SqlMapAccountDao extends SqlMapClientDaoSupport implements AccountDao {

 

    public Account getAccount(String email) throws DataAccessException {

        return (Account) getSqlMapClientTemplate().queryForObject("getAccountByEmail", email);

    }

 

    public void insertAccount(Account account) throws DataAccessException {

        getSqlMapClientTemplate().update("insertAccount", account);

    }

}

In the DAO, we use the pre-configured SqlMapClientTemplate to execute the queries, after setting up the SqlMapAccountDao in the application context and wiring it with our SqlMapClient instance:

<beans>

 

  <bean id="accountDao" class="example.SqlMapAccountDao">

    <property name="sqlMapClient" ref="sqlMapClient"/>

  </bean>

 

</beans>

Note that a SqlMapTemplate instance could also be created manually, passing in the SqlMapClient as constructor argument. The SqlMapClientDaoSupport base class simply pre-initializes aSqlMapClientTemplate instance for us.

The SqlMapClientTemplate also offers a generic execute method, taking a customSqlMapClientCallback implementation as argument. This can, for example, be used for batching:

public class SqlMapAccountDao extends SqlMapClientDaoSupport implements AccountDao {

 

    public void insertAccount(Account account) throws DataAccessException {

        getSqlMapClientTemplate().execute(new SqlMapClientCallback() {

            public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {

                executor.startBatch();

                executor.update("insertAccount", account);

                executor.update("insertAddress", account.getAddress());

                executor.executeBatch();

            }

        });

    }

}

In general, any combination of operations offered by the native SqlMapExecutor API can be used in such a callback. Any SQLException thrown will automatically get converted to Spring's genericDataAccessException hierarchy.

12.5.3. Implementing DAOs based on plain iBATIS API

DAOs can also be written against plain iBATIS API, without any Spring dependencies, directly using an injected SqlMapClient. A corresponding DAO implementation looks like as follows:

public class SqlMapAccountDao implements AccountDao {

       

    private SqlMapClient sqlMapClient;

   

    public void setSqlMapClient(SqlMapClient sqlMapClient) {

        this.sqlMapClient = sqlMapClient;

    }

 

    public Account getAccount(String email) {

        try {

            return (Account) this.sqlMapClient.queryForObject("getAccountByEmail", email);

        }

        catch (SQLException ex) {

            throw new MyDaoException(ex);

        }

    }

 

    public void insertAccount(Account account) throws DataAccessException {

        try {

            this.sqlMapClient.update("insertAccount", account);

        }

        catch (SQLException ex) {

            throw new MyDaoException(ex);

        }

    }

}

In such a scenario, the SQLException thrown by the iBATIS API needs to be handled in a custom fashion: usually, wrapping it in your own application-specific DAO exception. Wiring in the application context would still look like before, due to the fact that the plain iBATIS-based DAO still follows the Dependency Injection pattern:

<beans>

 

  <bean id="accountDao" class="example.SqlMapAccountDao">

    <property name="sqlMapClient" ref="sqlMapClient"/>

  </bean>

 

</beans>

Posted by 나랑살자
,