Dev/C#2012. 11. 22. 11:46

SQL Server 의 float 형식으로 저장 된 것을 C# 에서 SqlDatareader 를 이용해서 데이터를 가져오는데 문제 발생.
float 형식이니 SqlDataReader reader 의 reader.getFloat(0); 형식으로 가져오기를 했으나 exception 발생.

이유는 SQL Server 의 float 은 C#의 double 형식임.

double doubleData = reader.getDouble(0) 으로 가져오거나
float floatData = (float)reader.getDouble(0) 으로 가져오면 된다!

관련 url : http://msdn.microsoft.com/en-us/library/ms131092.aspx

Posted by 놀란
Dev/C#2012. 10. 18. 12:29

아래 코드 참조.
지메일 셋팅 하고, 파일 첨부해서 '비동기' 방식으로 보내기.
(주석처리된 send 는 동기 방식)
한글을 사용하기 위해 제목(subject), 내용(body) 의 인코딩을 UTF8로 셋팅해준다.

Posted by 놀란
Dev/C#2012. 10. 17. 12:13

솔루션, 프로젝트 파일을 공유하여 작업을 할 때, 각자의 셋팅 환경이 필요한 경우가 있었다.
이 때, 각자의 셋팅을 유지하기 위해서 각자 계정으로 분류하길 원했다.

사용한 메소드는

출처 : http://msdn.microsoft.com/en-us/library/sfs49sw0.aspx

Posted by 놀란
Dev/C#2012. 10. 17. 12:00

String.Contains 메소드 사용

Posted by 놀란
Dev/C#2012. 6. 19. 18:35

수 계산 중에 올림 값 표현을 위해서 Math.Ceiling 메소드를 사용하게 되었다.

그런데, 부동소수점 으로 인해서 원치 않는 올림이 되는 현상이 발생했다.

ex )

int value = 50;
double percent = 1.1d;
double result = Math.Ceiling(value * percent) ;

50 * 1.1 = 55 이고 올림을 해도 55가 나올 것으로 생각했으나
56 이 나오게 되었다. 알고 보니 부동소수점 밑으로 55.0000000000000007 뭐 이런 식으로 원치 않는 값이 들어와 있었다.

이래 저래 알아본 결과 System.Decimal.Ceiling 을 사용하게 되었다.
c# 에서 제공하는 통화를 위해 제공되고 있는 메소드 이다.

참고 : http://msdn.microsoft.com/ko-kr/library/364x0z75.aspx

 

Posted by 놀란
Dev/C#2012. 3. 23. 21:38

정적 메소드(Static Method)는 클래스의 인스턴스를 생성하지 않아도 호출이 가능한 메소드를 말한다. 정적 메소드는 static 키워드를 이용해서 선언한다.



인스턴스 메소드(Instance Method)는 이름처럼 클래스의 인스턴스를 생성해야만 호출할 수 있는 메소드를 말한다. 


Posted by 놀란
Dev/Unity3D2012. 3. 16. 12:25

PLATFORM 종류

UNITY_EDITOR Define for calling Unity Editor scripts from your game code.
UNITY_STANDALONE_OSX Platform define for compiling/executing code specifically for Mac OS (This includes Universal, PPC and Intel architectures).
UNITY_DASHBOARD_WIDGET Platform define when creating code for Mac OS dashboard widgets.
UNITY_STANDALONE_WIN Use this when you want to compile/execute code for Windows stand alone applications.
UNITY_WEBPLAYER Platform define for web player content (this includes Windows and Mac Web player executables).
UNITY_WII Platform define for compiling/executing code for the Wii console.
UNITY_IPHONE Platform define for compiling/executing code for the iPhone platform.
UNITY_ANDROID Platform define for the Android platform.
UNITY_PS3 Platform define for running Play Station 3 code.
UNITY_XBOX360 Platform define for executing XBbox 360 code.
UNITY_NACL Platform define when compiling code for Google native client (this will be set additionally to UNITY_WEBPLAYER).
UNITY_FLASH Platform define when compiling code for Adobe Flash.


UNITY 버전 

UNITY_2_6 Platform define for the major version of Unity 2.6.
UNITY_2_6_1 Platform define for specific version 1 from the major release 2.6.
UNITY_3_0 Platform define for the major version of Unity 3.0.
UNITY_3_0_0 Platform define for the specific version 0 of Unity 3.0.
UNITY_3_1 Platform define for major version of Unity 3.1.
UNITY_3_2 Platform define for major version of Unity 3.2.
UNITY_3_3 Platform define for major version of Unity 3.3.
UNITY_3_4 Platform define for major version of Unity 3.4.
UNITY_3_5 Platform define for major version of Unity 3.5.

TEST CODE

C# Example: JavaScript Example:


Posted by 놀란