영삼이의 IT정보2017. 3. 3. 10:42

cpu i7-7700k

메인보드 msi z270(돈 많으면 asus)

그래픽 msi 1070 8gb(부자면 1080)

파워 마이크로닉스 800w(부자면 1000w)

cpu쿨러 be quiet dark rock

ssd 삼성 pro 250gb

하드 시게이트 1~3tb

ram 삼성 16gb x 2

case 최신 발매 케이스 아무거나



Posted by 다오나무
영삼이의 IT정보2012. 10. 9. 14:26

pc-3000 udma




Posted by 다오나무
영삼이의 IT정보2012. 6. 26. 21:20

프로젝트를 새로 Import시
Remove @Override annotation 이란 에러가 @Override 있는 데마다 뜸.

--> 자바 빌드 버젼이 안 맞아서 그런다.

Project --> Properties --> Java Compiler --> Enable project specific settings 체크 박스 체크 
Compiler compliance settings 리스트박스에서 자신의 자바 버전에 맞게 선택 

 

Posted by 다오나무
영삼이의 IT정보2012. 6. 22. 11:18

<p>sqlite3 database;
 
//sqlite3 오픈및 생성
if (sqlite3_open([[self dataFilePath] UTF8String], &database) != SQLITE_OK) {
    sqlite3_close(database);
    NSAssert(0, @"Failed to open database");
}
 
else {
    char *errorMsg;
    NSString *createSQL1 = @"CREATE TABLE IF NOT EXISTS LOGS (ID INTEGER PRIMARY KEY
               AUTOINCREMENT, PHONENUMBER_DATA TEXT, NOW_DATE DATE, CALL_TIME TEXT);";
    if (sqlite3_exec (database, [createSQL1 UTF8String], NULL, NULL, &errorMsg) != SQLITE_OK) {
        sqlite3_close(database);
        NSLog(@"Error creating table: %s", errorMsg);
    }
    NSString *createSQL2 = @"CREATE TABLE IF NOT EXISTS ADDRESS (ID INTEGER PRIMARY KEY
               AUTOINCREMENT, NAME_DATA TEXT, PHONENUMBER_DATA TEXT, MEMO_DATA TEXT);";
    if (sqlite3_exec (database, [createSQL2 UTF8String], NULL, NULL, &errorMsg) != SQLITE_OK) {
        sqlite3_close(database);
        NSLog(@"Error creating table: %s", errorMsg);
    }
}
/* 여기서 생략된 -(NSString *)dataFilePath는 sqlite3파일이 있는 주소값을 리턴해주는 함수 입니다.
   지금 이 소스는 제가 실제로 썼던 소스라 두개의 테이블을 만들게 되어 있어요.
   ID integer primary key autoincrement는 자동으로 생성 되며 키값이 되구요, 그외 나머지는 Text,
   Date, Integer 등등 타입을 설정 할수 있어요 */
 
// 값을 받아 오기.
NSMutableArray *mutableLogData = [NSMutableArray array];
NSString *query = @"SELECT ID ,PHONENUMBER_DATA, NOW_DATE, CALL_TIME FROM LOGS ORDER
                    BY ID DESC";
sqlite3_stmt *statement;
if (sqlite3_prepare_v2(database, [query UTF8String], -1, &statement, nil) == SQLITE_OK) {
    while (sqlite3_step(statement) == SQLITE_ROW) {
        int idData = sqlite3_column_int(statement, 0);
        char *numberData = (char *)sqlite3_column_text(statement, 1);
        double dateData = sqlite3_column_double(statement, 2);
        char *callData = (char *)sqlite3_column_text(statement, 3);
        if (numberData != nil && dateData != 0 && idData != 0){
            NSNumber *idValue = [NSNumber numberWithInt:idData];
            NSString *numberValue = [[NSString alloc] initWithUTF8String:numberData];
            NSDate *dateValue = [NSDate dateWithTimeIntervalSince1970:dateData];
            NSString *callTimeValue = [[NSString alloc] initWithUTF8String:callData];
            NSArray *dataArray = [NSArray arrayWithObjects:idValue,
                                                           numberValue,
                                                           dateValue,
                                                           callTimeValue, nil];
            [mutableLogData addObject:dataArray];
            [numberValue release];
            [callTimeValue release];
        }
    }
}
sqlite3_finalize(statement);
/* logs라는 테이블의 id, phonenumber_data, now_date, call_time을 id의 역순으로 가져 오는
    부분 입니다.
    아주아주 쉬운 코드니 바로 아실듯 해요 ㅠ_ㅠ
    여기서는 제가 모든줄을 받아 오기 때문에 while문을 돌려 Array에 넣어주고 있어요 */
 
// 특정 줄의 삭제
 
char *errorMsg;
char *delete = "DELETE FROM ADDRESS WHERE ID = ?";
sqlite3_stmt *stmt;
if( sqlite3_prepare_v2(database, delete, -1, &stmt, nil) == SQLITE_OK) {
    sqlite3_bind_int(stmt, 1, [idData intValue]);
}
if (sqlite3_step(stmt) != SQLITE_DONE) {
    NSLog(@"Error deleting table: %s", errorMsg);
}
sqlite3_finalize(stmt);
 
/* id값을 받아 그것과 일치하는 address테이블의 줄을 삭제 해주는 코드 입니다.
    id는 당연 integer값이니 int형으로 넣구요. */
 
 
// 테이블에 값 입력하기
char *errorMsg;
char *update = "INSERT INTO LOGS (PHONENUMBER_DATA, NOW_DATE, CALL_TIME) VALUES (?,?,?);";
if (sqlite3_open([[self dataFilePath] UTF8String], &database) != SQLITE_OK) {
    sqlite3_close(database);
    NSAssert(0, @"Failed to open database");
}
sqlite3_stmt *stmt;
if( sqlite3_prepare_v2(database, update, -1, &stmt, nil) == SQLITE_OK) {
    sqlite3_bind_text(stmt, 1, [callNum UTF8String], -1, NULL);
    sqlite3_bind_double(stmt, 2, [nowDate timeIntervalSince1970]);
    sqlite3_bind_text(stmt, 3, [callTime UTF8String], -1, NULL);
};
if( sqlite3_step(stmt) != SQLITE_DONE)
    NSLog(@"Error updating table: %s", errorMsg);
sqlite3_finalize(stmt);
 
/* logs 테이블에 값을 넣는 코드 입니다.
    넣으려고 하는 값은 ?를 이용하여 따로 넣어 줄수 있어요.
    조금 아래를 보시면 bind를 이용해 값을 넣는 부분이 있어요 */
 
// 원래 있던 값 수정하기
char *errorMsg;
char *update =
     "UPDATE ADDRESS SET NAME_DATA=? , PHONENUMBER_DATA=? , MEMO_DATA=? WHERE ID=?;";
sqlite3_stmt *stmt;
if( sqlite3_prepare_v2(database, update, -1, &stmt, nil) == SQLITE_OK) {
    sqlite3_bind_text(stmt, 1, [name UTF8String], -1, NULL);
    sqlite3_bind_text(stmt, 2, [phoneNum UTF8String], -1, NULL);
    sqlite3_bind_text(stmt, 3, [memo UTF8String], -1, NULL);
    sqlite3_bind_int(stmt, 4, idNum);
}
if( sqlite3_step(stmt) != SQLITE_DONE)
NSLog(@"Error updating table: %s", errorMsg);
sqlite3_finalize(stmt);
 
/* address테이블의 id를 같은 값을 찾아 <br><span id="callbacknestceruleanbtistorycom68666" style="width:1px; height:1px; float:right"><embed allowscriptaccess="always" id="bootstrapperceruleanbtistorycom68666" src="http://ceruleanb.tistory.com/plugin/CallBack_bootstrapperSrc?nil_profile=tistory&nil_type=copied_post" width="1" height="1" wmode="transparent" type="application/x-shockwave-flash" enablecontextmenu="false" flashvars="&callbackId=ceruleanbtistorycom68666&host=http://ceruleanb.tistory.com&embedCodeSrc=http%3A%2F%2Fceruleanb.tistory.com%2Fplugin%2FCallBack_bootstrapper%3F%26src%3Dhttp%3A%2F%2Fs1.daumcdn.net%2Fcfs.tistory%2Fv%2F0%2Fblog%2Fplugins%2FCallBack%2Fcallback%26id%3D6%26callbackId%3Dceruleanbtistorycom68666%26destDocId%3Dcallbacknestceruleanbtistorycom68666%26host%3Dhttp%3A%2F%2Fceruleanb.tistory.com%26float%3Dleft" swliveconnect="true"></span>
   그 줄의 name_data, phonenumber_data, memo_data를 바꾸는 코드입니다.
   위랑 같이 ?를 이용해 따로 넣으실수 있어요 */
</p>

Posted by 다오나무
영삼이의 IT정보2012. 6. 21. 10:23


위와 같은 테이블 뷰를 구성할 때 체크박스를 선택하는 기능을 구현해야 한다. 선택된 값을 저장하는 시점도 필요한데 언제가 되야 할지 처음엔 다소 어렵게 느껴질 수 있다. 하지만 tableView:cellForRowAtIndexPath: 델리게이트 메서드를 이용해서 간단히 구현 할 수 있다.



우선 다음 코드를 보자 일반적인  tableView:cellForRowAtIndexPath: 구현이다.


1. 재사용을 위해 cellIdentifier을 선언한다. static NSString *cellIdentifier = @"CELL";


2. 만약 처음 cell을 생성해야 하는 경우는 if (cell == nil) 블럭 안에서 UITableViewCell이 생성 될 것이다. 나는 보통 셀이 생성될때 공통적인 속성을 설정한다. cell.selectionStyle을 설정한 것처럼 말이다.


3. 그 외 변동되는 부분은 아래의 코드에서 보듯이 cell의 객체가 nil이 아닐때 처리한다.


static NSString *cellIdentifier = @"CELL";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];


if (cell == nil) {

    cell = [[[UITableViewCell allocinitWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];

    cell.selectionStyle = UITableViewCellSelectionStyleGray;

}


if ([[self.item objectForKey:@"select"intValue] == indexPath.row) {

    cell.accessoryType = UITableViewCellAccessoryCheckmark;

    self.prevSelectedIndexPath = indexPath;

else {

    cell.accessoryType = UITableViewCellAccessoryNone;

}


cell.textLabel.text = [[self.item objectForKey:@"value"objectAtIndex:indexPath.row];


return cell;



위의 코드대로라면 select row의 값만 UITableViewCellAccessoryCheckmark 가 표시될 것이다.

이제 tableView:didSelectRowAtIndexPath:를 구현하면 되는데 선택되 었을때 다음 코드와 같이 하면 선택된 셀이 변경될 것이다. 


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

    [self.item setValue:[NSNumber numberWithInt:indexPath.rowforKey:@"select"];

    [tableView reloadData];

}



하지만 문제점이 있는데 바로 셀이 선택되는 순간 선택된 애니메이션이 보여지기도 전에 체크만되고 테이블 뷰가 리로드 될 것이다. 그래서 다음 코드를 적용하면 올바르게 동작할 것이다.  


1. 미리 저장된 이전에 선택된 셀의 IndexPath와 선택된 셀의 IndexPath를 비교해 동일하다면 return한다.


2. 만약 같지 않다면 reloadRowsAtIndexPath:withAnimation: 메서드를 사용해서 이전에 선택된 셀 및 선택된 셀을 리로드한다. 


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{

    NSComparisonResult result = [self.prevSelectedIndexPath compare:indexPath];

    if (result == NSOrderedSamereturn;

    

    //셀렉트 저장

    [self.item setValue:[NSNumber numberWithInt:indexPath.rowforKey:@"select"];

    [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:self.prevSelectedIndexPath, indexPath, nil]withRowAnimation:UITableViewRowAnimationFade];

}

'영삼이의 IT정보' 카테고리의 다른 글

Remove @Override annotation  (0) 2012.06.26
ios에서의 sqlite3 사용법  (0) 2012.06.22
iOS 5에서 UIAlertView에 추가된 것  (0) 2012.06.20
문자열 (NSString) 비교하기  (0) 2012.06.20
날짜/시각 구하기  (0) 2012.06.19
Posted by 다오나무
영삼이의 IT정보2012. 6. 20. 13:17

iOS 5부터 UIAlertView에 alertViewStyle 프라퍼티가 추가되었다. 기존에 약간의 커스텀 작업을 통해 텍스트필드를 추가할 수 있었는데 이제는 간단히 상수를 이용하여 원하는 작업을 좀더 간단히 할 수 있게 되었다. 자 간단히 살펴보자.

1. 기본 스타일

UIAlertView *alertView = [[UIAlertView allocinitWithTitle:@"기본 스타일"

                                                    message:@"기본 스타일의 얼럿 입니다."

                                                   delegate:self

                                          cancelButtonTitle:@"취소"

                                          otherButtonTitles:@"확인"nil];

[alertView show]

 

 
2. 텍스트 입력 스타일

UIAlertView *alertView = [[UIAlertView allocinitWithTitle:@"텍스트 입력 스타일"

                                                    message:@"텍스트 입력 스타일의 얼럿 입니다."

                                                   delegate:self

                                          cancelButtonTitle:@"취소"

                                          otherButtonTitles:@"확인"nil];

alertView.alertViewStyle = UIAlertViewStylePlainTextInput;

[alertView show];


이 경우 텍스트 필드에 입력된 데이터의 접근은 다음과 같이 한다.

UITextField *textField = [alertView textFieldAtIndex:0];

NSLog(@"Plain text input: %@",textField.text);


 3. 압호 입력 스타일

UIAlertView *alertView = [[UIAlertView allocinitWithTitle:@"암호 입력 스타일"

                                                    message:@"암호 입력 스타일의 얼럿 입니다."

                                                   delegate:self

                                          cancelButtonTitle:@"취소"

                                          otherButtonTitles:@"확인"nil];

alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;

[alertView show];


 
4. 로그인(ID)과 비밀번호 입력 스타일

UIAlertView *alertView = [[UIAlertView allocinitWithTitle:@"로그인과 비밀번호 입력 스타일"

                                                    message:@"로그인과 비밀번호를 입력하세요."

                                                   delegate:self

                                          cancelButtonTitle:@"취소"

                                          otherButtonTitles:@"확인"nil];

alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;

[alertView show];


이 경우 텍스트 필드에 입력된 데이터의 접근은 다음과 같이 한다.

UITextField *loginField = [alertView textFieldAtIndex:0];

NSLog(@"Login input: %@",loginField.text);

    

UITextField *passwordField = [alertView textFieldAtIndex:1];

NSLog(@"Password input: %@",passwordField.text);

 


또한, UIAlertViewDelegate에도 alertViewShouldEnableFirstOtherButton: 메서드가 추가 되었다. 이 메서드를 이용하여 다음과 같이 버튼을 동적으로 enabling/desabling 시킬 수 있다.

- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView

{

    UITextField *textField = [alertView textFieldAtIndex:0];

    if ([textField.text length] == 0)

    {

        return NO;

    }

    

    return YES;

}


 



Posted by 다오나무
영삼이의 IT정보2012. 6. 20. 12:36

NSString 레퍼런스를 참고 했을 때,
compare라는 메소드를 사용하면 가능하다고 나와있었는 데 실패했다.

출력하거나 메모리에서 비교하면 똑같은 데이터인데, 틀리다고 나와서..
(주 원인은 포인터값 때문에 그런지 아직도 못찾았다.)

 그래서 다음과 같은 방법도 시도.
NSString *title = @"편집"; 
if ( [title isEqualToString:@"편집"] );
(생략)

근데 역시 실패해서 c언어 스타일로 작성하니까 잘 되었음.


int test = strcmp([tempString UTF8String], [columnName UTF8String]);
   
상황에 따라 case by case 인지 확인을 정확히 해봐야 할 듯.

Posted by 다오나무
영삼이의 IT정보2012. 6. 19. 15:34

NSDate는 순수하게 시각값을 가진 오브젝트
실제로 그냥 출력을 하면 UTC(협정시)의 형태를 보여준다.

NSLog( @"%@", [ NSDate date ] ); -> 2012-06-11 08:02:34 +0000

시각값을 가지고 작업을 할 때에는 Time Zone 문제가 항상 존재하는데, NSDate 하나로는 해결하기 힘들다.

이때 시각값에 특정 포멧을 넣어 작업을 하기 위해서는 NSDateFormatter라는 것이 필요하다.

밑의 그림은 연습 프로그램의 일부이다.

NSDateFormatter의 메소드인 setTimeZone,  setDateFormat
setTimeZone은 특정 Time Zone을 설정할 수 있다.
setDateFormat은 표현하고자 하는 시각 포멧을 설정할 수 있다.

setDateFormat에서 설정할 수 있는 포멧은 잘 검색해 보길 바라고...
setTimeZone을 통해 정할 수 있는 NSTimeZone에 대해서 조금 더 설명해 보겠다.

NSTimeZone의 메소드 중 timeZoneWithName:( NSString * )을 사용했다. ( 위 소스에서 strCurRegion 부분 )
여기에서 NSString에 들어가는 텍스트가 중요한데, 내가 확인한 바로는 416개가 존재했다.
몽땅 여기에 써 넣을 수도 있겠지만, 직접 확인해보길...

해당 텍스트는 NSLog( @"%@", [ NSTimeZone knownTimeZoneNames ] )를 통해 알 수 있다.
결과값은 NSArray 이므로 쓰기 쉬울 것이다.


우리나라에서 표준시로 쓰고 있는 GMT+0900은 "Asia/Seoul"로 표현되어 있다.
"Asia/Tokyo"로 써도 똑같다는 것은 비☆밀 -ㅅ-;



또한 NSDateFormatter로 각각의 시각 성분을 뽑아낼 수도 있다.

이런식으로 각각의 성분을 뽑아서 따로 사용할 수도 있다. 


특정 시각을 설정하고 싶을 때에는 NSDateComponents를 사용한다.

또 여기에서 NSCalendar가 나오는데 이건 나도 자세히는 모르겠다...
아무튼 이런식으로 특정 시각 값을 가진 NSDate 오브젝트를 얻을 수 있다.


마지막으로 NSDateFormatter에서 dateFromString이라는 메소드가 있는데, 2012-06-11 08:02:34 +0000 이러한 텍스트를 넣어주면 
그에 따른 시각값을 가진 NSDate 오브젝트를 얻을 수 있다.


시각 값 조작하는 코드가 너무 많은 것 같아서 조금 헛갈리는데, 나는 이 정도로만 사용할 것이다.

NSDate의 메소드 중에는 timeIntervalSince... 시리즈가 있는데, 타이머에 사용할 시간이나, 두 시각 값 사이의 차이 시간이라든지 여러가지로 활용할 부분이 많을 것이다.

Posted by 다오나무
영삼이의 IT정보2012. 6. 15. 09:40

만약 윈도우 apache가 start가 안된다면


80번 포트가 사용중인지 확인해 본다.


나 같은 경우 teamviewer라는 원격제어 프로그램이 

80번 포트를 사용하고 있어서 옵션에서 꺼주었다.


이상.


Posted by 다오나무
영삼이의 IT정보2012. 6. 14. 15:18

ViewController 위에 TableView를 올렸을 때 에러나는 이유


뷰 컨트롤러에 테이블뷰를 올리고 나서

스크롤을 아래로 내리면 에러나는 경우는


ChattingViewController *chattingViewController = [[ChattingViewController alloc] initWithNibName:@"ChattingViewController" bundle:nil];


위에처럼하지말고


아래처럼 .h파일에다가 먼저 선언을 해주고 아래처럼 구현해야 한다.

    chattingViewController = [[ChattingViewController alloc] initWithNibName:@"ChattingViewController" bundle:nil];

Posted by 다오나무