2019년 8월 26일 월요일

Kodi 마우스휠을 배속조절로 바꾸기

<keymap>
  <Global>
    <mouse>
 <!--     <wheeldown>VolumeDown</wheeldown> --> <!-- Remove arrows to enable global volume control -->
 <!--     <wheelup>VolumeUp</wheelup> --> <!-- Remove arrows to enable global volume control -->
    </mouse>
  </Global>
  <FullScreenVideo>
    <mouse>
      <mousedrag>noop</mousedrag>
      <mousemove>noop</mousemove>
      <wheeldown>PlayerControl(tempodown)</wheeldown>
      <wheelup>PlayerControl(tempoup)</wheelup>
    </mouse>
  </FullScreenVideo>
  <VideoMenu>
    <mouse>
      <mousedrag>mousedrag</mousedrag>
      <mousemove>mousemove</mousemove>
      <wheeldown>PlayerControl(tempodown)</wheeldown>
      <wheelup>PlayerControl(tempoup)</wheelup>
    </mouse>
  </VideoMenu>
  <VideoOSD>
    <mouse>
      <mousedrag>mousedrag</mousedrag>
      <mousemove>mousemove</mousemove>
      <wheeldown>PlayerControl(tempodown)</wheeldown>
      <wheelup>PlayerControl(tempoup)</wheelup>
    </mouse>
  </VideoOSD>
 <Visualisation>
    <mouse>
      <mousedrag>noop</mousedrag>
      <mousemove>noop</mousemove>
      <wheeldown>PlayerControl(tempodown)</wheeldown>
      <wheelup>PlayerControl(tempoup)</wheelup>
    </mouse>
  </Visualisation>
  <MusicOSD>
    <mouse>
      <mousedrag>mousedrag</mousedrag>
      <mousemove>mousemove</mousemove>
      <wheeldown>PlayerControl(tempodown)</wheeldown>
      <wheelup>PlayerControl(tempoup)</wheelup>
    </mouse>
  </MusicOSD>
</keymap>



mouse.xml로 저장하고 코디폴더에 넣어 사용...
어디에 넣었는지는 까먹음...
Z28 TV박스 사용할 때 써 먹었는데
그냥 라이젠 2200g 플루이드모션 사용하는 itx 초 미니PC 제작해서 사용중...

2012년 2월 9일 목요일

[Android] View Animation_Code

AnimationSet set = new AnimationSet( true );
set.setInterpolator( new AccelerateInterpolator() ); // JAVA CODE로 애니메이션 설정

Animation animation = new AlphaAnimation( 0.0f, 1.0f ); // 투명도를 조절. 페이드아웃
// Animation animation = new TranslateAnimation(StartX, EndX, StartY, EndY); // 이동 애니메

animation.setDuration(100); // 애니메이션 동작시간 0.1초
set.addAnimation(animation);

TextView tv = (TextView)findViewById(R.id.textView2); // 텍스트뷰로 테스트
tv.setAnimation(animation);

TextView tv2 = (TextView)findViewById(R.id.textView1);
tv2.setAnimation(animation);
tv2.startAnimation(animation); // 애니메이션 시작

2012년 2월 8일 수요일

[Android] 사각형 그리기

커스텀뷰의 OnDraw에서 그림.

// 사각형 그리기
Paint Pnt = new Paint();   // 페인트 생성
Pnt.setColor(0xfff612ab);  // 핑크색
Pnt.setAlpha(70); // 반투명
RectF r = new RectF(getWidth()*0.5f, getHeight()*0.1f, getWidth()*0.9f, getHeight()*0.35f); // 시작 X,Y 좌표, 끝 X,Y 좌표
canvas.drawRoundRect(r,5,5, Pnt); // 사각형 모서리 깎아 그리기

[JAVA] boolean To String

boolean CHECK = true;
String trueOrFalse = String.valueOf(CHECK);
System.out.println(trueOrFalse);
-------------------
output: true

[Android] Image resize 기법

OnCreate ---------
// 배경화면 그리기 - 이미지 뷰를 읽어 기기 사이즈에 맞춘다.
ImageView imgview = (ImageView)findViewById(R.id.imgviewbackgroundcoffee); // xml 이미지가 들어갈 이미지뷰를 가져온다.
Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.coffee2); // 비트맵 이미지를 만든다.
int width=(int)(getWindowManager().getDefaultDisplay().getWidth()); // 가로 사이즈 지정
int height=(int)(getWindowManager().getDefaultDisplay().getHeight() * 0.8); // 세로 사이즈 지정
Bitmap resizedbitmap=Bitmap.createScaledBitmap(bmp, width, height, true); // 이미지 사이즈 조정
imgview.setImageBitmap(resizedbitmap); // 이미지뷰에 조정한 이미지 넣기
       

2011년 12월 6일 화요일

[C#] TCP전송 Receive 방법

public void RecevieStart()
        {
            while (true)
            {
                if (Server == null) continue;
                if (Server.Connected == false) continue;
                // 데이터 받을 변수
                byte[] receiveData = ReceiveData(Server);
             
                // 백그라운드워커는 한번에 하나씩만 실행 가능. 따라서 이벤트 핸들러를 새로 만들어 백그라운드워커 돌림
                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += new DoWorkEventHandler(bgw1_RunWorkerCompleted);
                worker.RunWorkerAsync(receiveData);
            }
        }

여기서 Server는 보내는 쪽과 연결되어 있는 소켓
Socket Server = null; 로 선언.

여기서 ReceiveData() 함수는 개인적으로 입맛에 맞게 만든 함수.
Server.ReceiveBegin( ......) 을 사용하는것과 크게 다를것이 없다.

여기서 백그라운드 워커는 받을 때 object sender 로 받는게 아니라 DoWorkEventArgs e.Argument 로 받는다.

2011년 6월 19일 일요일

[Object C] sqlite3 사용 소스

출처 : http://cafe437.daum.net/_c21_/bbs_search_read?grpid=1LrnV&fldid=Ukxs&contentval=0000Azzzzzzzzzzzzzzzzzzzzzzzzz&nenc=&fenc=&q=loop&nil_profile=cafetop&nil_menu=sch_updw


아이폰 SQLite3 샘플
iPhone 2008/11/25 14:18 
SQLite는 경량화된 DB로 맥과 아이폰/아이팟 터치에 기본적으로 내장되어 편리하게 사용할 수 있습니다. 자세한 내용은 SQLite 공식 홈페이지와 아래의 문서들을 참조하시면 도움이 되실 것입니다.


•SQLite C Interface - Functions
•SQLite In 5 Minutes Or Less
•Wikipedia - SQLite


이와함께 애플의 iPhoneDev Center에 SQLite Book List란 샘플을 보시면, 아이폰 SDK에서 사용하는 방법이 잘 나와있습니다. SQLite의 개발자인 Richard Hipp이 구글 테크토크에서 직접 SQLite에 대해서 설명하는 'An Introducion to SQLite'란 동영상도 참고하면 좋습니다.



--------------------------------------------------------------------------------



아래는 제가 SQLite를 테스트 해보기 위해 만들어 본 간단한 샘플코드입니다. 아이폰에서 사용자로 부터 입력을 받은 후에 SQLite DB에 저장하는 간단한 샘플입니다. DB를 오픈하는 부분과 SELECT, INSERT하는 부분만 참고하시면 쉽게 사용하실 수 있습니다. 


* SQLiteTestAppDelegate.h

#import! <UIKit/UIKit.h>
#import! <sqlite3.h>

@interface SQLiteTestAppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    sqlite3 *db;
    NSMutableArray *dataList;

    IBOutlet UITextField *newString;
    IBOutlet UITableView *dataTable;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

- (void)updateDataList;

- (IBAction)addRow:(id)sender;
    
@end



SQLiteTestAppDelegate.m

#import! "SQLiteTestAppDelegate.h"

@implementation SQLiteTestAppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

    // Override point for customization after application launch
    [window makeKeyAndVisible];
    
    /* 어플리케이션 패스를 구한다. */     
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *path = [documentsDirectory stringByAppendingPathComponent:@"mydata.db"];
        
    /* 데이터베이스를 오픈한다 */
    if(sqlite3_open([path UTF8String], &db) == SQLITE_OK) {
        char *error = NULL;
        const char* query = "SELECT count(*) from mytable";
        
        /* mytable을 쿼리해보고 오류가 있으면 mytable을 생성한다. */
        if (sqlite3_exec(db, query, NULL, 0, &error) != SQLITE_OK) {
            sqlite3_free(error);
            
            /* 테이블 생성 */
            if (sqlite3_exec(db, "CREATE TABLE mytable ('name' CHAR(16))", NULL, 0, &error) != SQLITE_OK) {
                NSLog(@"TABLE CREATE ERROR: %s", error);
                sqlite3_free(error);
            }    
        }
    } else {
        /* DB 오픈 에러 */
        sqlite3_close(db);
        db = NULL;
        
        NSLog(@"DB OPEN ERROR: '%s'", sqlite3_errmsg(db));    
    }
    
    dataList = [[NSMutableArray alloc] initWithCapacity:100];
    
    [self updateDataList];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    if (db) {
        sqlite3_close(db);
    }
}

- (void)dealloc {
    [dataList release];
    
    [window release];
    [super dealloc];
}

/** 현재 DB에 있는 데이터를 dataList에 등록 */
- (void)updateDataList {
    
    /* 이전 데이터를 모두 삭제 */
    [dataList removeAllObjects];
    
    const char *query = "SELECT name FROM mytable";
    sqlite3_stmt *statement;
    
    if (sqlite3_prepare_v2(db, query, -1, &statement, NULL) == SQLITE_OK) {
        while (sqlite3_step(statement) == SQLITE_ROW) {
            
            /* dataList에 쿼리결과 등록 */
            NSString* str = [[NSString alloc] initWithUTF8String:(char *)sqlite3_column_text(statement, 0)];
            [dataList addObject:str];
            [str release];
        }
    }
    sqlite3_finalize(statement);

    [dataTable reloadData];
}


#pragma mark IBACTION

- (IBAction)addRow:(id)sender {

    char *error = NULL;
    
    /* 사용자가 입력한 값을 DB에 추가한다 */
    NSString *query = [NSString stringWithFormat:@"INSERT INTO mytable VALUES ('%@')", [newString text]];
    sqlite3_exec(db, [query UTF8String], NULL, 0, &error);
    
    [self updateDataList];
}


#pragma mark TextField Delegate method

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    
    [textField resignFirstResponder];
    return YES;
}


#pragma mark TableView Delegate method

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
    return @"Table Items";
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [dataList count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *cellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier] autorelease];
    }
    cell.text = [dataList objectAtIndex:indexPath.row];
    
    return cell;
}

@end