검색결과 리스트
Skills/Programming에 해당되는 글 16건
- 2016.03.31 fatal error C1083: 컴파일러 중간 파일 파일을 열 수 없습니다.
- 2016.02.19 시리얼 통신 (serial communication ) 연결 안될 때.. open port 실패
- 2016.02.16 [아두이노] arduino에서 char to int
- 2016.02.15 serial communication에서 inturrupt를 사용하는 이유
- 2016.02.06 [안드로이드] 디바이스를 못찾을 때..
- 2016.01.14 MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트]
- 2015.06.22 [OpenGL] 3D coordinates from 2D mouse click ( Convert Screen Coordinate to World Coordinate )
- 2015.06.08 KB954430 자꾸만 다시 설치하라고 할 때..
- 2015.05.21 MATLAB에서 Figure docking (default) 1
- 2015.01.15 [Assertion failed] wincore.cpp error line 952
글
fatal error C1083: 컴파일러 중간 파일 파일을 열 수 없습니다.
위와 같은 error 메세지를 받았을 때, 다양한 경로로 해결 방법을 시도해 보았지만 해결이 되지 않았다.
확실한 것은 아닌데.. Dropbox를 잠시 중단시켜놓았더니 잘 되었음.
추측으로는.. Dropbox에서 동기화를 위해 pch 파일에 접근하면서 pch 파일 생성에 충돌이 발생한 것은 아닐까 싶다.
'Skills > Programming' 카테고리의 다른 글
시리얼 통신 (serial communication ) 연결 안될 때.. open port 실패 (0) | 2016.02.19 |
---|---|
[아두이노] arduino에서 char to int (0) | 2016.02.16 |
serial communication에서 inturrupt를 사용하는 이유 (0) | 2016.02.15 |
[안드로이드] 디바이스를 못찾을 때.. (0) | 2016.02.06 |
MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트] (0) | 2016.01.14 |
글
시리얼 통신 (serial communication ) 연결 안될 때.. open port 실패
근본적인 이유는 찾지 못했다.
아래처럼 같은 코드를 했는데도 연결이 안되었더랬다..
theApp.T_SW->_serial.OpenPort(_T("COM8"), CBR_115200, 8, ONESTOPBIT, NOPARITY)
theApp.T_SW->_serial.OpenPort(_T("COM18"), CBR_9600, 8, ONESTOPBIT, NOPARITY)
코드는 같은데 왜 연결이 안되냐?
나는 멀티바이트와 유니코드의 문제일까 싶어 많은 시행착오를 겪었다...
그러나 결국 해결해 준 것은, COM18이라는 숫자가 불길해서 COM2로 재할당 (윈도우 장치관리자에서 가능하다)했더니 그냥 연결이 되었다는 것이다..
theApp.T_SW->_serial.OpenPort(_T("COM2"), CBR_9600, 8, ONESTOPBIT, NOPARITY)
도대체 이런 일이 왜 벌어졌던 걸까?
'Skills > Programming' 카테고리의 다른 글
fatal error C1083: 컴파일러 중간 파일 파일을 열 수 없습니다. (0) | 2016.03.31 |
---|---|
[아두이노] arduino에서 char to int (0) | 2016.02.16 |
serial communication에서 inturrupt를 사용하는 이유 (0) | 2016.02.15 |
[안드로이드] 디바이스를 못찾을 때.. (0) | 2016.02.06 |
MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트] (0) | 2016.01.14 |
글
[아두이노] arduino에서 char to int
arduino를 쓰면서 atoi를 쓰고 있었는데.. 뭔가 형 변환이 잘 안되는 느낌이었다.
그래서 열심히 구글링을 하다보니..
char array 끝에 '\0' 가 있어야 했다..
* Ref
[1] http://forum.arduino.cc/index.php?topic=103511.0
'Skills > Programming' 카테고리의 다른 글
fatal error C1083: 컴파일러 중간 파일 파일을 열 수 없습니다. (0) | 2016.03.31 |
---|---|
시리얼 통신 (serial communication ) 연결 안될 때.. open port 실패 (0) | 2016.02.19 |
serial communication에서 inturrupt를 사용하는 이유 (0) | 2016.02.15 |
[안드로이드] 디바이스를 못찾을 때.. (0) | 2016.02.06 |
MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트] (0) | 2016.01.14 |
글
serial communication에서 inturrupt를 사용하는 이유
openCM 9.04의 예를 들어보자.
openCM의 처리기에서는 loop() 구문의 내용이 계속 돌고 있다.
이 속에서 serial communication의 데이터를 처리하면 그 사이에 들어오는 데이터를 받지 못하는 경우가 발생한다.
따라서 interrupt 구문 안에서 데이터를 처리해야 하며, interrupt 구문은 최대한 간결하게 짜는 것이 좋겠다.
'Skills > Programming' 카테고리의 다른 글
시리얼 통신 (serial communication ) 연결 안될 때.. open port 실패 (0) | 2016.02.19 |
---|---|
[아두이노] arduino에서 char to int (0) | 2016.02.16 |
[안드로이드] 디바이스를 못찾을 때.. (0) | 2016.02.06 |
MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트] (0) | 2016.01.14 |
[OpenGL] 3D coordinates from 2D mouse click ( Convert Screen Coordinate to World Coordinate ) (0) | 2015.06.22 |
글
[안드로이드] 디바이스를 못찾을 때..
사용하는 기기의 드라이버를 적절하게 설치했는지를 확인하자.
본인의 경우 S사의 갤럭*노*2를 사용했는데 아래의 드라이버를 설치해서 문제를 해결할 수 있었다.
http://local.sec.samsung.com/comLocal/support/down/kies_main.do?kind=usb
'Skills > Programming' 카테고리의 다른 글
[아두이노] arduino에서 char to int (0) | 2016.02.16 |
---|---|
serial communication에서 inturrupt를 사용하는 이유 (0) | 2016.02.15 |
MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트] (0) | 2016.01.14 |
[OpenGL] 3D coordinates from 2D mouse click ( Convert Screen Coordinate to World Coordinate ) (0) | 2015.06.22 |
KB954430 자꾸만 다시 설치하라고 할 때.. (0) | 2015.06.08 |
글
MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트]
기존에 VS2010에서 잘 실행되던 프로그램이 VS2013으로 migration을 한 후에 소켓 통신이 정상적으로 이루어지지 않는 현상이 발생했다.
결론부터 이야기하자면, 아래 속성의 그림에서 볼 수 있듯 vs2013부터 MFC에서는 유니코드를 쓰기를 원한다고(?)한다(이 부분은 확실치 않지만, 멀티바이트를 사용하기 위해서는 따로 추가 설치를 해야 한다.).
결국 문제의 원인은 inet_addr() 함수가 char* 형 변수를 받아야 하는데, VS2013부터는 MFC에서 char* 형 변수가뜻대로 동작하지 않을 때가 많다.
따라서 유니코드 프로그램을 작성하면 inet_addr()함수를 쓰기 귀찮아진다.
{
#ifdef UNICODE
char IP[16];
int Ret = 0;
Ret = WideCharToMultiByte(CP_ACP, 0, cp, _tcslen(cp), IP, 15, NULL, NULL);
IP[Ret] = 0;
#endif
return init_addr(cp);
#endif
* Ref
'Skills > Programming' 카테고리의 다른 글
serial communication에서 inturrupt를 사용하는 이유 (0) | 2016.02.15 |
---|---|
[안드로이드] 디바이스를 못찾을 때.. (0) | 2016.02.06 |
[OpenGL] 3D coordinates from 2D mouse click ( Convert Screen Coordinate to World Coordinate ) (0) | 2015.06.22 |
KB954430 자꾸만 다시 설치하라고 할 때.. (0) | 2015.06.08 |
MATLAB에서 Figure docking (default) (1) | 2015.05.21 |
글
[OpenGL] 3D coordinates from 2D mouse click ( Convert Screen Coordinate to World Coordinate )
[1]
GLpoint GetOGLMousePos(GLint x, GLint y) { GLfloat winX = 0.0, winY = 0.0, winZ = 0.0; // never ever make a mistake between float and double. I wasted my 4 days to solve this and the problem was, I was using GLdouble here instead of GLfloat. Try GLdouble here you will see a hell difference in output values. GLdouble posX = 0.0, posY = 0.0, posZ = 0.0; winX = (float)x; winY = (float)OGLMviewport[3] - (float)y; // invert winY so that down lowers value glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ ); gluUnProject( winX, winY, winZ, OGLMmodelview, OGLMprojection, OGLMviewport, &posX, &posY, &posZ); return GLpoint(posX, posY, -posZ); // invert z value }
[2]
private void glControl1_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { if (!loadedTK) return; // Play nice int[] viewport = new int[4]; double[] modelViewMatrix = new double[16]; double[] projectionMatrix = new double[16]; if (checkBoxSelectPoints.Checked == true) { int mouseX = e.X; int mouseY = e.Y; //Get Matrix OpenTK.Graphics.OpenGL.GL.GetInteger(OpenTK.Graphics.OpenGL.GetPName.Viewport, viewport); OpenTK.Graphics.OpenGL.GL.GetDouble(OpenTK.Graphics.OpenGL.GetPName.ModelviewMatrix, modelViewMatrix); OpenTK.Graphics.OpenGL.GL.GetDouble(OpenTK.Graphics.OpenGL.GetPName.ProjectionMatrix, projectionMatrix); //Calculate NearPlane point and FarPlane point. One will get the two end points of a straight line //that "almost" intersects the plotted point you "clicked". Vector3 win = new Vector3(mouseX, viewport[3] - mouseY, 0); Vector3 worldPositionNear; Glu.UnProject(win, modelViewMatrix, projectionMatrix, viewport, out worldPositionNear); win.Z = 1.0f; Vector3 worldPositionFar; Glu.UnProject(win, modelViewMatrix, projectionMatrix, viewport, out worldPositionFar); //Calculate the lenght of the straigh line (the distance between both points). double distanceNF = Math.Sqrt(Math.Pow(worldPositionNear.X - worldPositionFar.X, 2) + Math.Pow(worldPositionNear.Y - worldPositionFar.Y, 2)+ Math.Pow(worldPositionNear.Z - worldPositionFar.Z, 2)); double minDist = distanceNF; //Calculate which of the plotted points is closest to the line. In other words, // look for the point you tried to select. Calculate the distance between the 2 endpoints that passes through // each plotted point. The one that is most similar with the straight line will be the selected point. int selectedPoint = 0; for (int i = 0; i < PointsInfo.Count; i++) { double d1 = Math.Sqrt(Math.Pow(worldPositionNear.X - PointsInfo[i].Position.X, 2) + Math.Pow(worldPositionNear.Y - PointsInfo[i].Position.Y, 2) + Math.Pow(worldPositionNear.Z - PointsInfo[i].Position.Z, 2)); double d2 = Math.Sqrt(Math.Pow(PointsInfo[i].Position.X - worldPositionFar.X, 2) + Math.Pow(PointsInfo[i].Position.Y - worldPositionFar.Y, 2) + Math.Pow(PointsInfo[i].Position.Z - worldPositionFar.Z, 2)); if (((d1 + d2) - distanceNF) <= minDist) { minDist = (d1 + d2) - distanceNF; selectedPoint = i; } } //Just select/unselect points if the "click" was really close to a point. Not just by clicking anywhere in the screen if (minDist < 0.000065) { if (selectedPoints.Contains(selectedPoint)) selectedPoints.Remove(selectedPoint); else selectedPoints.Add(selectedPoint); glControl1.Invalidate(); //paint again } }
[3]
private Vector3d GetOGLPos(int x, int y)
{
int[] viewport = new int[4];
double[] matrixprojection = new double[16];
double[] matrixmodeview = new double[16];
double WinX, WinY;
float[] WinZ = new float[1];
double PosX, PosY, PosZ;
IntPtr PixelPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(sizeof(float));
GL.glGetDoublev(GL.GL_PROJECTION_MATRIX, matrixprojection);
GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX, matrixmodeview);
GL.glGetIntegerv(GL.GL_VIEWPORT, viewport);
GL.glEnable(GL.GL_DEPTH_TEST);
GL.glDepthMask(1);
GL.glDepthRange(0, 1);
System.Runtime.InteropServices.Marshal.Copy(WinZ, 0, PixelPtr, 1);
WinX = (double)x;
WinY = (double)viewport[3] - (double)y;
GL.glReadPixels(x, (int)WinY, 1, 1, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, PixelPtr);
System.Runtime.InteropServices.Marshal.Copy(PixelPtr, WinZ, 0, 1);
System.Runtime.InteropServices.Marshal.FreeHGlobal(PixelPtr);
GL.gluUnProject(WinX, WinY,(double)WinZ[0], matrixmodeview, matrixprojection, viewport,out PosX,out PosY,out PosZ);
//PosZ = (double)WinZ[0];
Vector3d result = new Vector3d(PosX, PosY, PosZ);
return result;
}
* Ref
[1] http://www.gamedev.net/topic/632454-incorrect-3d-coordinates-from-2d-mouse-click/
[2] http://www.opentk.com/node/1892
[3] http://www.opentk.com/node/480
'Skills > Programming' 카테고리의 다른 글
[안드로이드] 디바이스를 못찾을 때.. (0) | 2016.02.06 |
---|---|
MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트] (0) | 2016.01.14 |
KB954430 자꾸만 다시 설치하라고 할 때.. (0) | 2015.06.08 |
MATLAB에서 Figure docking (default) (1) | 2015.05.21 |
[Assertion failed] wincore.cpp error line 952 (0) | 2015.01.15 |
글
KB954430 자꾸만 다시 설치하라고 할 때..
아래 사이트를 참조하자.
https://social.technet.microsoft.com/Forums/windows/ko-KR/646651ca-1a32-46d3-bc5e-8d8a77eff9a7/update-kb954430?forum=w7itprogeneral
'Skills > Programming' 카테고리의 다른 글
MFC에서 소켓통신이 잘 안될 때.. [유니코드 멀티바이트] (0) | 2016.01.14 |
---|---|
[OpenGL] 3D coordinates from 2D mouse click ( Convert Screen Coordinate to World Coordinate ) (0) | 2015.06.22 |
MATLAB에서 Figure docking (default) (1) | 2015.05.21 |
[Assertion failed] wincore.cpp error line 952 (0) | 2015.01.15 |
C++ 반전 연산자~와 논리 연산자 !의 차이 (0) | 2014.12.16 |
글
MATLAB에서 Figure docking (default)
MATLAB을 사용하다보면 figure를 main GUI에 docking하고 싶을 때가 있다. (default로..)
아래를 참조하면 된다!!
I just wanted to pass along a small tip that you might find useful. If you’ve become as big of a fan of docked figures as I have, you might be looking for a way to have figures docked by default when they are created. This is easy to do (but not obvious) by modifying default figure properties. The following command will cause all subsequent new figures in the current MATLAB session to open docked:
Put this command in your startup.m file for this to be the default behavior for every MATLAB session.
Don’t like it?
This will set things back to normal.
Want to understand how this command works?
This is the standard graphics set command. The first argument is the handle to the root graphics object, i.e. the screen. This applies to all subequently generated graphics objects. When a figure is docked, it’s WindowStyle property is set to ‘docked’. Since this is a Figure property, I can modify it’s default behavior by appending DefaultFigure to WindowStyle. Hence,
* Ref.
[1] http://blogs.mathworks.com/pick/2005/11/15/default-docked-figures/
'Skills > Programming' 카테고리의 다른 글
[OpenGL] 3D coordinates from 2D mouse click ( Convert Screen Coordinate to World Coordinate ) (0) | 2015.06.22 |
---|---|
KB954430 자꾸만 다시 설치하라고 할 때.. (0) | 2015.06.08 |
[Assertion failed] wincore.cpp error line 952 (0) | 2015.01.15 |
C++ 반전 연산자~와 논리 연산자 !의 차이 (0) | 2014.12.16 |
공유 메모리를 이용한 IPC (0) | 2014.12.15 |
글
[Assertion failed] wincore.cpp error line 952
MFC does not support calling a window from a thread that did not create the window. Your call to OnIdle violates that restriction.
Each thread uses a separate message queue, so it is also a bad idea to attempt to use the main message queue from your thread.
Why are you creating windows in your thread? It is best to create all windows in the main thread, and use secondary threads for non-GUI processing.
When you create a thread in an MFC program you are supposed to use AfxBeginThread, not the CreateThread API. AfxBeginThread will call CreateThread for you, after doing whatever MFC needs in order to work properly.
* Ref
https://social.msdn.microsoft.com/Forums/vstudio/en-US/38f58a71-2d5f-44fd-b3a1-37bafa6e54bd/assert-in-multithread-program-with-function-onidle0?forum=vcgeneral
'Skills > Programming' 카테고리의 다른 글
KB954430 자꾸만 다시 설치하라고 할 때.. (0) | 2015.06.08 |
---|---|
MATLAB에서 Figure docking (default) (1) | 2015.05.21 |
C++ 반전 연산자~와 논리 연산자 !의 차이 (0) | 2014.12.16 |
공유 메모리를 이용한 IPC (0) | 2014.12.15 |
MFC dialog에서 콘솔(console)로 디버깅하기 (0) | 2014.12.15 |