프로그램/Android 2013. 3. 12. 10:31

안드로이드 토스트 연속 출력 및 위치 지정하기


//선언
 
static Toast mtoast;
 
 
 
// 사용
 
void toastprint(string string){
 
 
 
 if (mtoast == null) {
    mtoast = Toast.makeText(mContext, string, length);
   } else {
    mtoast.setText(string +"set");
   }
 

       int offsetX = 10;
       int offsetY = 10;
       mtoast.setGravity(Gravity.CENTER, offsetX, offsetY);
       mtoast.show(); 

}

프로그램/C# 2013. 3. 12. 00:51

C# 화면 캡쳐

화면 캡쳐


   public void ScreenCapture(Size ScreenSize, String FileName)
 
        {
 
            Bitmap bitmap = new Bitmap(ScreenSize.Width,ScreenSize.Height);
 
            Graphics g = Graphics.FromImage(bitmap);
 
            g.CopyFromScreen(new Point(0, 0), new Point(0, 0), ScreenSize);
 
            bitmap.Save(FileName, ImageFormat.Bmp);
 
        }





'프로그램 > C#' 카테고리의 다른 글

C# 리스트뷰 체크된 아이템 얻기  (0) 2013.03.25
크로스 스레드 해결법  (0) 2013.03.19
C# MDI 폼안에 폼 띵우기  (0) 2013.03.12
C# 폼 투명하게 하기  (0) 2013.03.12
C# 파일경로  (0) 2013.03.08
프로그램/C# 2013. 3. 12. 00:49

C# MDI 폼안에 폼 띵우기

MDI

 Form2 dong =new Form2();
 dong.MdiParent=this; 
dong.Show();


폼안에서만 이동이 가능하다.

'프로그램 > C#' 카테고리의 다른 글

크로스 스레드 해결법  (0) 2013.03.19
C# 화면 캡쳐  (0) 2013.03.12
C# 폼 투명하게 하기  (0) 2013.03.12
C# 파일경로  (0) 2013.03.08
C# 메모리 줄이기, 메모리 강제회수  (0) 2013.03.08
프로그램/C# 2013. 3. 12. 00:46

C# 폼 투명하게 하기




private void Form1_Load(object sender, EventArgs e)
        {
            this.Visible = false;
            this.ShowInTaskbar = false;
        }
 ==========================
  label7.Parent = progressBar1;
 
transparent
 

 폼로드시 해당 함수호출
        private void WorkUnitSeting_Load(object sender, EventArgs e)
        {
            //배경이 있는 컨트롤 투명처리
            SetCtlsArgb();
        }
 
        /// 
        /// 배경이 있는 컨트롤 투명처리
        /// 
        private void SetCtlsArgb()
        {
            Control.ControlCollection coll = this.Controls;
            foreach (Control c in coll)
            {
                if (c != null)
                {
                    // CheckBox , Lable인 컨트롤의 경우 투명하게 처리합니다.
                    if (c.GetType() == typeof(CheckBox) || c.GetType() == typeof(Label))
                    {
                        c.BackColor = Color.FromArgb(0, 0, 0, 0);
                    }
 
                }
 
            }
        }





'프로그램 > C#' 카테고리의 다른 글

C# 화면 캡쳐  (0) 2013.03.12
C# MDI 폼안에 폼 띵우기  (0) 2013.03.12
C# 파일경로  (0) 2013.03.08
C# 메모리 줄이기, 메모리 강제회수  (0) 2013.03.08
C# 웹 검색  (0) 2013.03.08
프로그램/Android 2013. 3. 12. 00:03

디버깅빠르게 하기 aapt

디버깅빠르게 하기 aapt

출처 : http://forum.xda-developers.com/showthread.php?t=1907281

다운로드 (익스플로러로 다운 잘안됨): http://forum.xda-developers.com/attachment.php?attachmentid=1368522&d=1349123034

Presenting: Fast AAPT - aka FAAPT

Lately Android development has been getting me down. Slow builds all over the place in many of my app projects, and my PC is blazing fast - it shouldn't all be that slow, even if you're running Eclipse!

Working on DSLR Controller has been driving me mad - testing a minor change in the underlying communications library, then building and launching the app - ugh! So I set out to fix this. I had done all the usual tricks, even gave Eclipse loads more memory (helped with regular performance, but not building) but nothing major seemed to change. Then I figured out most of the time building was spent in AAPT. So I synced my AOSP repo (2012.09.26, took a few minutes), tried to get the Windows SDK to build on my Linux b

 

ox (took several hours) and finally got to actually mucking with the source.

Found the bottleneck (for my long-build-time projects at least, related to XML file compilation) and fixed it (by introducing a simple cache). "DLSR Controller" build time has gone down from 35 seconds minimum, to 2-3 seconds ( >10 times faster). Hell, I can even turn "Build Automatically" back on without getting constant delays!

Note that my build times quoted only apply to incremental internal builds. If your images still need to be "crushed" (optimized), or you're "exporting" an APK (final build for publication), build time will still be significantly longer. However, during normal development and testing (by far most builds if you're making an app in Eclipse) those stages are not performed, and builds should be lightning fast.

"Fixed" is a big word though, right now it's more of a "hack", and it needs some pollish, so the patch can be submitted to AOSP. I don't want to keep it from you for that long, so my first test build is attached - don't use it in production builds..

Patch code has been submitted to:
AOSP - #1 Cancelled, #2 Review in Progress ... superseded by ctate rewrite
AOKP - #1 Merged, #2 Merged
CM - #1 Cancelled, #2 Merged

Attached ZIP includes Linux, Windows and Mac OS X versions.

The files are drop-in replacement, but I would certainly advise you to backup the originals for your production builds! Also, don't forget to chmod/chown on Linux or it won't work.

Enjoy and leave some feedback

Will this help your project build ?

A quick way to spot if this will have effect on your slow build is as follows:

- In Eclipse, set Build output to Verbose under Window -> Preferences -> Android -> Build.
- Clean and build your project.
- If the build pauses on lines in the "(new resource id <filename> from <filename>)" format, you have the problem FAAPT fixes

(of course, you can also run aapt manually if you know how, you'll get the same output)

In a full framework build the optimizations only affect a very small portion of the actions done during the build, so you won't see any spectaculair speed increases there.

Update (#2)

I have updated the patch code to fix problems with Mac OS X compatibility, I've also included a Mac OS X binary in the new zip file.

 

http://log.hanjava.net/post/32862213063/fast-aapt-android

 

이 친구는 DSLR Controller라는 프로젝트를 진행하는데 자신의 PC 성능이 고사양인데도 불구하고 Android 빌드 시간이 너무 오래 걸림에 분을 삭히지 못하고 원인파악에 돌입함.

원인은 AAPT(Android Asset Packaging Tool)의 XML compilation time이 너무 오래걸림을 파악하고 변경된 XML만 처리하도록 caching을 추가.

이 친구는 35초 걸리던 빌드가 2~3초로 줄었다는데 과장은 살짝 섞인듯(분명 남자인듯)

사용법은 간단. zip파일을 다운로드하면 Windows, Linux, Mac용 aapt가 있는데 이를 Android SDK/platform-tools 아래의 aapt와 교체하면 끝.

테스트 결과 eclipse에서는 빨라지는데 android-maven-plugin에서는 별 도움이 안됨. 왜 인지는 모르겠음

 

 

아래 파일은 링크 오류시를 받기위해 올려 놓음 아래에서 받지 마시고 링크에서 받으세요  

 

aapt-2.zip

프로그램/Android 2013. 3. 12. 00:02

안드로이드 엑티비티 투명 , android activity Dim

public popup_away(Context context) {
super(context, android.R.style.Theme_Translucent_NoTitleBar);
// TODO Auto-generated constructor stub
cont = context;
 
}
 
///또하나
final Dialog dialog = new Dialog(this, R.style.Theme_Dialog);


///아래는 XML로 하는것

프로그램/Android 2013. 3. 11. 23:59

안드로이드 Intent 사용법

// 웹페이지 띄우기 
Uri uri = Uri.parse("http://www.google.com"); 
Intent it  = new Intent(Intent.ACTION_VIEW,uri); 
startActivity(it); 

// 구글맵 띄우기 
Uri uri = Uri.parse("geo:38.899533,-77.036476"); 
Intent it = new Intent(Intent.Action_VIEW,uri); 
startActivity(it);  

// 구글 길찾기 띄우기 
Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=출발지주소&daddr=도착지주소&hl=ko"); 
Intent it = new Intent(Intent.ACTION_VIEW,URI); 
startActivity(it); 

// 전화 걸기 
Uri uri = Uri.parse("tel:xxxxxx"); 
Intent it = new Intent(Intent.ACTION_DIAL, uri);   
startActivity(it);   
Uri uri = Uri.parse("tel.xxxxxx"); 
Intent it = new Intent(Intent.ACTION_CALL,uri); 

// 퍼미션을 잊지 마세요.  
// SMS/MMS 발송 
Intent it = new Intent(Intent.ACTION_VIEW);    
it.putExtra("sms_body", "The SMS text");    
it.setType("vnd.android-dir/mms-sms");    
startActivity(it);   

// SMS 발송 
Uri uri = Uri.parse("smsto:0800000123");    
Intent it = new Intent(Intent.ACTION_SENDTO, uri);    
it.putExtra("sms_body", "The SMS text");    
startActivity(it);   

// MMS 발송 
Uri uri = Uri.parse("content://media/external/images/media/23");    
Intent it = new Intent(Intent.ACTION_SEND);    
it.putExtra("sms_body", "some text");    
it.putExtra(Intent.EXTRA_STREAM, uri);    
it.setType("image/png");    
startActivity(it);  

// 이메일 발송 
Uri uri = Uri.parse("mailto:xxx@abc.com"); 
Intent it = new Intent(Intent.ACTION_SENDTO, uri); 
startActivity(it); 
Intent it = new Intent(Intent.ACTION_SEND);    
it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");    
it.putExtra(Intent.EXTRA_TEXT, "The email body text");    
it.setType("text/plain");    
startActivity(Intent.createChooser(it, "Choose Email Client"));   
Intent it = new Intent(Intent.ACTION_SEND);      
String[] tos = {"me@abc.com"};      
String[] ccs = {"you@abc.com"};      
it.putExtra(Intent.EXTRA_EMAIL, tos);      
it.putExtra(Intent.EXTRA_CC, ccs);      
it.putExtra(Intent.EXTRA_TEXT, "The email body text");      
it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");      
it.setType("message/rfc822");      
startActivity(Intent.createChooser(it, "Choose Email Client"));   
 
// extra 추가하기 
Intent it = new Intent(Intent.ACTION_SEND);    
it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");    
it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");    
sendIntent.setType("audio/mp3");    
startActivity(Intent.createChooser(it, "Choose Email Client")); 

// 미디어파일 플레이 하기 
Intent it = new Intent(Intent.ACTION_VIEW); 
Uri uri = Uri.parse("file:///sdcard/song.mp3"); 
it.setDataAndType(uri, "audio/mp3"); 
startActivity(it); 
Uri uri = Uri.withAppendedPath( 
  MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");    
Intent it = new Intent(Intent.ACTION_VIEW, uri);    
startActivity(it);   

// 설치 어플 제거 
Uri uri = Uri.fromParts("package", strPackageName, null);    
Intent it = new Intent(Intent.ACTION_DELETE, uri);    
startActivity(it); 

// APK파일을 통해 제거하기 
Uri uninstallUri = Uri.fromParts("package", "xxx", null); 
returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri); 

// APK파일 설치 
Uri installUri = Uri.fromParts("package", "xxx", null); 
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri); 

// 음악 파일 재생 
Uri playUri = Uri.parse("file:///sdcard/download/everything.mp3"); 
returnIt = new Intent(Intent.ACTION_VIEW, playUri); 

// 첨부파일을 추가하여 메일 보내기 
Intent it = new Intent(Intent.ACTION_SEND);   
it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");   
it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/eoe.mp3");   
sendIntent.setType("audio/mp3");   
startActivity(Intent.createChooser(it, "Choose Email Client")); 

// 마켓에서 어플리케이션 검색 
Uri uri = Uri.parse("market://search?q=pname:pkg_name");   
Intent it = new Intent(Intent.ACTION_VIEW, uri);   
startActivity(it);   

// 패키지명은 어플리케이션의 전체 패키지명을 입력해야 합니다. 
// 마켓 어플리케이션 상세 화면 
Uri uri = Uri.parse("market://details?id=어플리케이션아이디");   
Intent it = new Intent(Intent.ACTION_VIEW, uri);   
startActivity(it); 

// 아이디의 경우 마켓 퍼블리싱사이트의 어플을 선택후에 URL을 확인해보면 알 수 있습니다. 
// 구글 검색 
Intent intent = new Intent(); 
intent.setAction(Intent.ACTION_WEB_SEARCH); 
intent.putExtra(SearchManager.QUERY,"searchString") 
startActivity(intent);

프로그램/기타 2013. 3. 8. 02:12

cmd 실행 명령어


[일반 명령어]
calc (계산기)
charmap 문자표
cleanmgr 디스크정리
clipbrd (클립보드에 복사된 내용 표시)
cmd(도스명령프롬프트 실행) 단, 윈98은 command
control (제어판)
dfrg.msc 디스크 조각모음
dxdiag (다이렉트X 진단도구 및 그래픽과 사운드의 세부정보를 보여줌)
eudcedit 사용자 정의 문자 편집기
explorer 탐색기
magnify 돋보기
mobsync 동기화
msconfig(시작프로그램 제어등 많은기능 제공)
msinfo32 시스템정보
mstsc 원격 데스크톱 연결
netstat -na(현재 열린포트와 TCP/IP 프로토콜정보를 보여줌)
열린포트로 트라이목마형 바이러스 침투 유무확인가능
notepad 메모장
ntbackup 백업 및 복원 마법사
osk 화상키보드
pbrush 또는 mspaint (그림판)
ping 사이트주소(핑테스트 해당 사이트의 인터넷연결 유무 확인)
regedit(레지스트리 편집기)
sfc(시스템 파일 검사기)
- 시스템 파일을 검사한후 깨지거난 손실된 파일을 원본 압축파일에서 찾아서 복원시켜줌
단, 윈2000에서는 cmd실행 후 sfc사용 - 마지막 설정된 값을 다음 윈도우부팅시 곧바로 실행됨[수정]
sndrec32 녹음기
sndvol32 (시스템 사운드 등록정보,볼륨조절)
sysedit(autoexec.bat, config.sys, win.ini, system.ini 시스템구성편집기)
systray(사운드 볼륨설정 노란색 스피커 아이콘을 트라이목록에 띄움)
telnet open 사이트주소(텔넷접속명령어)
tourstart (윈도우 기능안내 html 문서표시)
wab 주소록
winipcfg(인터넷에 접속된 자신의 아이피 주소를 보여줌) 단, 윈2000은 ipconfig로 변경됨
winmine (지뢰찾기)
winver (윈도우 버전확인)
wmplayer (윈도우 미디어 플레이어)
wordpad 워드패드
wscui.cpl 보안센터
wupdmgr 윈도우업데이트



[MSC 명령어]

certmgr.msc : 인증서 관리
ciadv.msc : 인덱싱 서비스
compmgmt.msc : 컴퓨터 관리
devmgmt.msc : 장치관리자
dfrg.msc : 디스크 조각 모음
diskmgmt.msc : 디스크 관리
eventvwr.msc : 이벤트 뷰어 (이벤트 로그)
fsmgmt.msc : 공유 폴더 (공유 폴더 관리)
gpedit.msc : 그룹 정책
lusrmgr.msc : 로컬 사용자 및 그룹
ntmsmgr.msc : Removable Storage
ntmsoprq.msc : 이동식 저장소 운영자 요청
perfmon.msc : 성능
rsop.msc : 정책의 결과 집합
secpol.msc : 로컬 보안 설정
services.msc : 서비스
wmimgmt.msc : WMI 서비스 구성
comexp.msc : comexp 구성 요소 서비스
control userpasswords2 : 사용자 계정

 

http://wearekorean.co.kr/zbxe/411

프로그램/C# 2013. 3. 8. 02:11

C# 파일경로

C#.NET에서 파일경로를 손쉽게 다룰수 있도록 하는 내장객체..



기존의 프로그래밍에서는 파일의 경로부분을 얻기위해, split()나, mid(), right() 메서드 등을 사용하였습니다. 하지만 C#.NET에서는 Path객체를 통해서 확장자 부분만 얻기 외에 다수의 파일경로에 대한 처리를 지원하고 있습니다.

1. 먼저 사용하기 위해서는 using System.IO;를 선언해야합니다.
2. Path객체를 특별히 따로 선언해서 사용하는 것이아니라, static 메서드를 활용하여 경로부분을 원하는데로 다룰 수 있게 됩니다.

Path.ChangeExtension(string path) : 경로문자열에서 확장명 부분을 변경합니다.
Path.GetDirectoryName(string path) : 경로문자열에서 파일이름을 제외한 경로부분(디렉터리명)을 반환 합니다.
Path.GetExtension(string path) : 경로문자열에서 확장명 부분만 반환합니다.
Path.HasExtension(string path) : 경로문자열에서 확장명 부분이 있는지 확인하여 bool값으로 반환합니다.

Path.GetFileName(string path) : 경로문자열에서 파일이름부분을 반환합니다.
Path.GetFileNameWithoutExtension(string path) : 경로문자열에서 확장명부분을 제외한 파일이름을 반환합니다.
Path.GetFullPath(string path) : 경로문자열에 해당하는 절대경로를 반환합니다.
Path.GetPathRoot(string path) : 경로문자열에서 루트디렉터리(드라이브 명) 부분만 반환합니다.
Path.GetRandomFileName() : 파일 또는 폴더명으로 사용가능한 임의의 문자열을 반환합니다.
Path.GetTempFileName() : 임의로 임시파일을 생성 후, 생성된 임시파일의 경로를 반환합니다. 임시파일은 시스템의 지정된 임시폴더(Temp)에 생성됩니다.
Path.GetTempPath() : 시스템에 지정된 임시폴더의 경로를 반환합니다.
Path.IsPathRooted(string path) : 매개변수로 지정된 경로문자열이 상대경로인지 절대경로인지 파악하여 bool값으로 반환합니다. 절대경로이면 true를 반환합니다.
Path.GetInvalidFileNameChars() : 파일이름으로 부적합한 문자들의 배열을 반환합니다.
Path.GetInvalidPathChars() : 경로명으로 부적합한 문자들의 배열을 반환합니다.

 

'프로그램 > C#' 카테고리의 다른 글

C# MDI 폼안에 폼 띵우기  (0) 2013.03.12
C# 폼 투명하게 하기  (0) 2013.03.12
C# 메모리 줄이기, 메모리 강제회수  (0) 2013.03.08
C# 웹 검색  (0) 2013.03.08
C# 키 이벤트 ...  (0) 2013.03.08
프로그램/C# 2013. 3. 8. 02:08

C# 메모리 줄이기, 메모리 강제회수




using System.Runtime.InteropServices; 

 
 

        #region 강제 메모리 회수 

        [DllImportAttribute("kernel32.dll", EntryPoint = "SetProcessWorkingSetSize", ExactSpelling = true, CharSet = 

CharSet.Ansi, SetLastError = true)] 

        private static extern int SetProcessWorkingSetSize(IntPtr process, int minimumWorkingSetSize, int 

maximumWorkingSetSize); 

        public static void FlushMemory() 
        { 

            GC.Collect(); 

            GC.WaitForPendingFinalizers(); 

            if (Environment.OSVersion.Platform == PlatformID.Win32NT) 
            { 

                SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1); 
            } 

        } 

        #endregion 



'프로그램 > C#' 카테고리의 다른 글

C# 폼 투명하게 하기  (0) 2013.03.12
C# 파일경로  (0) 2013.03.08
C# 웹 검색  (0) 2013.03.08
C# 키 이벤트 ...  (0) 2013.03.08
C# try - catch 예외 처리  (0) 2013.03.08