Programming/Java2009. 9. 3. 22:01
java랑 안친해서 전혀 몰랐는데..
이런 충격적인 사실이 있었다니 -ㅁ-!


대충 검색해보니 unsigned - signed 변환에 예외가 많이 생기니까
차라리 전부 signed로 통일해버리면 깔끔해지기는 할듯 하다라는 이야기가 많이 나온다.

2.1.1 Primitive Data Types

Other than the primitive data types discussed here, everything in the Java programming language is an object. Even the primitive data types can be encapsulated inside library-supplied objects if required. The Java programming language follows C and C++ fairly closely in its set of basic data types, with a couple of minor exceptions. There are only three groups of primitive data types, namely, numeric types, character types, and Boolean types.

Numeric Data Types
Integer numeric types are 8-bit byte, 16-bit short, 32-bit int, and 64-bit long. The 8-bit byte data type in Java has replaced the old C and C++ char data type. Java places a different interpretation on the char data type, as discussed below.

There is no unsigned type specifier for integer data types in Java.

Real numeric types are 32-bit float and 64-bit double. Real numeric types and their arithmetic operations are as defined by the IEEE 754 specification. A floating point literal value, like 23.79, is considered double by default; you must explicitly cast it to float if you wish to assign it to a float variable.

2.1.2 Arithmetic and Relational Operators

All the familiar C and C++ operators apply. The Java programming language has no unsigned data types, so the >>> operator has been added to the language to indicate an unsigned (logical) right shift. Java also uses the + operator for string concatenation; concatenation is covered below in the discussion on strings.
[링크 : http://java.sun.com/docs/white/langenv/Simple.doc1.html]

  • byte: The byte data type is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. They can also be used in place of int where their limits help to clarify your code; the fact that a variable's range is limited can serve as a form of documentation.

  • short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters.

  • int: The int data type is a 32-bit signed two's complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive). For integral values, this data type is generally the default choice unless there is a reason (like the above) to choose something else. This data type will most likely be large enough for the numbers your program will use, but if you need a wider range of values, use long instead.

  • long: The long data type is a 64-bit signed two's complement integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (inclusive). Use this data type when you need a range of values wider than those provided by int.

  • float: The float data type is a single-precision 32-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification. As with the recommendations for byte and short, use a float (instead of double) if you need to save memory in large arrays of floating point numbers. This data type should never be used for precise values, such as currency. For that, you will need to use the java.math.BigDecimal class instead. Numbers and Strings covers BigDecimal and other useful classes provided by the Java platform.

  • double: The double data type is a double-precision 64-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification. For decimal values, this data type is generally the default choice. As mentioned above, this data type should never be used for precise values, such as currency.

  • boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information, but its "size" isn't something that's precisely defined.

  • char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).

Data Type Default Value (for fields)
byte 0
short 0
int 0
long 0L
float 0.0f
double 0.0d
char '\u0000'
String (or any object)   null
boolean false

[링크 : http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html ]


'Programming > Java' 카테고리의 다른 글

Java 에서 파일 목록 엳어오기  (0) 2011.10.29
netbeans 에서 코드 자동정렬  (0) 2011.10.29
Java용 폴더 다이얼로그  (0) 2011.10.28
netbeans IDE  (0) 2010.08.23
unit test - 단위 테스트  (0) 2010.08.18
Posted by 구차니


위의 옵션은 1.14.3에도 존재하는 녀석이다.
Shell - alias support를 선택해주면 된다.
Posted by 구차니
게임/마비노기2009. 9. 2. 19:49

낙시 하려고 숫자키 누르다가 반신화 변신할 때..
스킬창에 ctrl - 2,3,4,5,6,7 이런식으로 카테고리를 고르고
1,2,3,4... 로 스킬이 시전되는데

생활은 ctrl - 2
그런데 가끔 반신화 창에서 스킬보다가 창을 닫고 아무생각없이 낙시 한다고 1을 누르면.. 변신한다...

매우.. 가슴이 아프다 ㅠ.ㅠ
Posted by 구차니
Programming/C Win32 MFC2009. 9. 2. 18:09

CEdit 컨트롤의 색상을 변경하기 위해서는 WM_CTLCOLOR을 이용한다.
일단 전역변수로 CBrush COLORREF 변수를 선언해준다.
그리고 나서 클래스 위저드에서 다이얼로그 자체의 WM_CTLCOLOR을 생성해준다.

이 녀석은 그리기 전에 메시지를 가로채서 색상을 설정해주는 역활을 한다고 한다.

OnInitDialog() 에서
    m_redcolor=RGB(255,0,0);                      // red
    m_bluecolor=RGB(0,0,255);                     // blue
    m_textcolor=RGB(255,255,255);                 // white text
    m_redbrush.CreateSolidBrush(m_redcolor);      // red background
    m_bluebrush.CreateSolidBrush(m_bluecolor);    // blue background
이런식으로 브러시와 색상을 미리 설정해준다.

그 다음에, OnCtlColor에서 GetDlgCtrlID()에 의해 분기를 쳐주면서
원하는 컨트롤의 ID에 연결해주면 원하는 색상으로 그려진다.

    pDC->SetBkColor(m_bluecolor);
    pDC->SetTextColor(m_textcolor);
    hbr = (HBRUSH) m_bluebrush;

위의 내용을 사용하면되며,
    SetBKColor()은 배경색상(기본값은 흰색)
    SetTextColor()은 글씨색상(기본값은 검은색)
을 변경해주게 된다.

브러시를 리턴함으로, 이 브러시를 이용하여 실제로 변경한 색상으로 그려주게 된다.


아래는 OnCtlColor의 기본 템플릿이다.
클래스위저드가 생성하면 // TODO 사이의 내용이 없으므로 불편하다.
HBRUSH CBarcodeDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	switch(nCtlColor)
	{
		case CTLCOLOR_EDIT:
		case CTLCOLOR_MSGBOX:
			switch (pWnd->GetDlgCtrlID())
			{
				default:
					break;
			}
			break;

		case CTLCOLOR_STATIC:
			switch (pWnd->GetDlgCtrlID())
			{
				default:
					break;
			}
			break;

		default:
			break;
	}
	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}


[링크 : http://www.codeguru.com/Cpp/controls/editctrl/backgroundcolor/article.php/c3929/#more]
[링크 : http://mind444.tistory.com/64]
Posted by 구차니
프로그램 사용/vi2009. 9. 2. 18:01
:set ci
혹은
/\c[검색어]

case ignore 에서 c 인가보다.
근데.. 막상해보니 case insensitive 한데?

[링크 : http://unixjunkie.blogspot.com/2006/03/ignore-case-in-vim-searches.html]



:set ignorecase
:set noignorecase

로 토글한다고 한다.

[링크 : http://www.tech-recipes.com/rx/406/perform-case-insensitive-searches-in-vi-or-vim/]




단어단위로 검색할경우(whole word match)
/\<검색어\>

[링크 : http://www.held.org.il/blog/?p=129]

'프로그램 사용 > vi' 카테고리의 다른 글

vi auto indent  (0) 2009.10.06
busybox 1.14.3 vi editor  (0) 2009.09.16
VI에 ctags 사용하기  (0) 2009.07.21
VI syntax highlight 사용하기  (0) 2009.05.26
VI - hex mode  (2) 2009.03.03
Posted by 구차니
Linux2009. 9. 2. 17:59
$ man grep
       -v, --invert-match
              Invert the sense of matching, to select non-matching lines.

-v 옵션은 invert match로 문장을 포함하지 않는 줄을 출력해준다.


사용예 : 주석이 아닌 줄만 찾기
Posted by 구차니
구차니 패닉이라고 적을려다보니... 전에 적었던거 같아서 다른 제목으로 끄적끄적.


문득 친구 1과 친구 2와 이야기 하는데
내가 하고 싶은게 머지? 라는 의문이 들었다.

지금 딱히 하고 싶은건
USB 카메라 사서 영상 인식 openCV라고 한번 돌려보는거
AVR로 서보모터 제어하는거
그리고 자전거 타고 좀 싸돌아 다니는거
그리고 잠시 쉬고 싶은거


요즘에는 집에가서 게임한다고 많은 시간을 빼앗기면서
게임안하고 하면 될 것들을 이렇게 고민하는 걸 보면 참.. 바보 같기도 하고..

그래도 쉬고 싶다라는 생각과 함께
학교로 돌아가고 싶다는 생각도 조금은 드는건 왜일까..
필드에서 조금 굴렀다고 거만해진걸까?

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

출근일기 - 20090921  (16) 2009.09.21
출장의 장점?  (4) 2009.09.09
결국 짬밥  (0) 2009.08.28
짧지만 매우 강렬한 유머(?)  (11) 2009.08.26
내 책상에 하나둘씩 늘어가는 장비들  (0) 2009.08.19
Posted by 구차니
install.txt 파일에 다음의 내용이 있었다. (역시 설명서는 잘 읽어야 해..)

Microsoft Windows, Microsoft Visual C++ 6 Developer Studio:

We include makefiles that should work as project files in DevStudio 6.0 or later.
There is a library makefile that builds the IJG library as a static Win32 library,
and application makefiles that build the sample applications as Win32 console applications.
(Even if you only want the library, we recommend building the applications so that you can run the self-test.)

To use:
1. Copy
jconfig.vc to jconfig.h
makeadsw.vc6 to apps.dsw
makecdep.vc6 to cjpeg.dep
makecdsp.vc6 to cjpeg.dsp
makecmak.vc6 to cjpeg.mak
makeddep.vc6 to djpeg.dep
makeddsp.vc6 to djpeg.dsp
makedmak.vc6 to djpeg.mak
makejdep.vc6 to jpeg.dep
makejdsp.vc6 to jpeg.dsp
makejdsw.vc6 to jpeg.dsw
makejmak.vc6 to jpeg.mak
makerdep.vc6 to rdjpgcom.dep
makerdsp.vc6 to rdjpgcom.dsp
makermak.vc6 to rdjpgcom.mak
maketdep.vc6 to jpegtran.dep
maketdsp.vc6 to jpegtran.dsp
maketmak.vc6 to jpegtran.mak
makewdep.vc6 to wrjpgcom.dep
makewdsp.vc6 to wrjpgcom.dsp
makewmak.vc6 to wrjpgcom.mak
(Note that the renaming is critical!)

2. Click on jpeg.dsw and apps.dsw to load the project workspaces.
   (If you are using DevStudio more recent than 6.0, you'll probably
   get a message saying that the project files are being updated.)

3. Build the library project, then the applications project.

4. Move the application .exe files from `app`\Release to an appropriate location on your path.

5. To perform the self-test, execute the command line
    NMAKE /f makefile.vc  test



2단계에서 dsw 파일 읽어 오는것은 실패했다.. OTL
아무튼 5단계의 nmake를 이용하면 컴파일까지 완료된다.


Microsoft Windows, Microsoft Visual C++ 2008 Developer Studio (v9):

We include makefiles that should work as project files in Visual Studio 2008 or later.
There is a library makefile that builds the IJG library as a static Win32 library,
and application makefiles that build the sample applications as Win32 console applications.
(Even if you only want the library, we recommend building the applications so that you can run the self-test.)

To use:
1. Copy
jconfig.vc to jconfig.h
makeasln.vc9 to apps.sln
makecvcp.vc9 to cjpeg.vcproj
makedvcp.vc9 to djpeg.vcproj
makejsln.vc9 to jpeg.sln
makejvcp.vc9 to jpeg.vcproj
makervcp.vc9 to rdjpgcom.vcproj
maketvcp.vc9 to jpegtran.vcproj
makewvcp.vc9 to wrjpgcom.vcproj
(Note that the renaming is critical!)

2. Click on jpeg.sln and apps.sln to load the project solutions.
   (If you are using Visual Studio more recent than 2008 (v9), you'll
   probably get a message saying that the project files are being updated.)

3. Build the library project, then the applications project.

4. Move the application .exe files from `app`\Release to an appropriate location on your path.

5. To perform the self-test, execute the command line
    NMAKE /f makefile.vc  test

Posted by 구차니
Microsoft/Visual Studio2009. 9. 1. 16:50
머.. 가장 편한건 dsw 파일이 있는거지만,
없으면 생성을 해주어야 한다.

방법 1. project wizard의 makefile을 이용해서 프로젝트를 생성

[링크 : http://msdn.microsoft.com/en-us/library/txcwa2xx%28VS.80%29.aspx]
[링크 : http://msdn.microsoft.com/en-us/library/8y48z24a%28VS.80%29.aspx]


방법 2. nmake를 이용해서 프로젝트를 생성

namke /f "project.mak"


[링크 : http://woohaha.egloos.com/301383/]

방법 3. devenv(Visual Studio 2008
그런데 이 nmake는 VC++6 이후로는 포함이 되지 않아서 다른 방법으로 해야 한다고 한다.
devenv라는 녀석으로 하면된다는데.. VC++6 이상을 설치하지 않고, 사용하지 않아서 확인불가 OTL

[링크 : http://blog.daum.net/aswip/8224572]
[링크 : http://msdn.microsoft.com/en-us/library/xee0c8y7.aspx]
Posted by 구차니
$ gdb --help
This is the GNU debugger.  Usage:

    gdb [options] [executable-file [core-file or process-id]]
    gdb [options] --args executable-file [inferior-arguments ...]

Options:

  --args             Arguments after executable-file are passed to inferior
  -b BAUDRATE        Set serial port baud rate used for remote debugging.
  --batch            Exit after processing options.
  --batch-silent     As for --batch, but suppress all gdb stdout output.
  --return-child-result
                     GDB exit code will be the child's exit code.
  --cd=DIR           Change current directory to DIR.
  --command=FILE, -x Execute GDB commands from FILE.
  --eval-command=COMMAND, -ex
                     Execute a single GDB command.
                     May be used multiple times and in conjunction
                     with --command.
  --core=COREFILE    Analyze the core dump COREFILE.
  --pid=PID          Attach to running process PID.
  --dbx              DBX compatibility mode.
  --directory=DIR    Search for source files in DIR.
  --epoch            Output information used by epoch emacs-GDB interface.
  --exec=EXECFILE    Use EXECFILE as the executable.
  --fullname         Output information used by emacs-GDB interface.
  --help             Print this message.
  --interpreter=INTERP
                     Select a specific interpreter / user interface
  -l TIMEOUT         Set timeout in seconds for remote debugging.
  --nw             Do not use a window interface.
  --nx               Do not read .gdbinit file.
  --quiet            Do not print version number on startup.
  --readnow          Fully read symbol files on first access.
  --se=FILE          Use FILE as symbol file and executable file.
  --symbols=SYMFILE  Read symbols from SYMFILE.
  --tty=TTY          Use TTY for input/output by the program being debugged.
  --tui              Use a terminal user interface.
  --version          Print version information and then exit.
  -w                 Use a window interface.
  --write            Set writing into executable and core files.
  --xdb              XDB compatibility mode.

For more information, type "help" from within GDB, or consult the
GDB manual (available as on-line info or a printed manual).
Report bugs to "bug-gdb@gnu.org".

스크립트에는 gdb에서 입력하던 명령어들을 넣어주면 된다.

[링크 : http://darkfader.net/arm/files/Example%20GDB%20script.txt]

'프로그램 사용 > gdb & insight' 카테고리의 다른 글

insight(gdb) 아키텍쳐별 차이점(?)  (0) 2010.05.18
gdb cross compile 관련  (0) 2010.05.18
gdb 명령어 - next / step / [엔터]  (0) 2009.07.01
gdb help  (0) 2009.06.26
간단한 gdb/gdbserver/insight 사용법  (0) 2009.06.26
Posted by 구차니