# Python1.py import programimport source def main(): print("in Python1.py", __name__) program.main() source.main() if __name__ == "__main__": main() # program.py def main(): print("in program.py", __name__) if __name__ == "__main__": main() # source.py def main(): print("in source.py", __name__) if __name__ == "__main__": main()
import sys # virtualenv if hasattr(sys, 'real_prefix') \ and hasattr(sys, 'base_prefix') \ and hasattr(sys, 'prefix') \ and sys.base_prefix == sys.prefix: print("in virtualenv environment") print("sys.real_prefix", sys.real_prefix) print("sys.base_prefix", sys.base_prefix) print("sys.prefix ", sys.prefix) # venv if not hasattr(sys, 'real_prefix') \ and hasattr(sys, 'base_prefix') \ and hasattr(s..
unsafe keyword를 사용하면 , C/C++에서 사용하는 pointer를 C#에서도 사용할 수 있다. unsafe keyword를 사용하기 위해서 compile할 때 /unsafe option을 주어야한다. compile할 때 /unsafe option을 주려면 Visual Studio에서 아래와 같이 설정해주면 된다. 참고 : /unsafe (C# Compiler Options) To set /unsafe compiler option in the Visual Studio development environmentOpen the project's Properties page. Click the Build property page. Select the Allow Unsafe Code check bo..
사용환경 : Visual Studio 2017, Windows 10 x64 C#과 C++을 Mixing해서 코딩하는 방법을 알아보자. C++ Class를 C#에서 사용하는 예제를 하나 진행해보자. C++ Class를 만든 후, 그 C++ Class를 사용하는 C++/CLI Class를 만든 다음, C#에서 C++/CLI Class를 사용하는 방식으로 진행하려고 한다. 먼저 Visual Studio에서 “Blank Solution”을 하나 만들자. Solution 이름은 “Hybrid1”으로 하자. Hybrid1 Solution에 “Windows Desktop Wizard”로 Visual C++ Project를 하나 추가한다. Project 이름은 “Native1”으로 하자. Application type..
Enable SQL Server TCP/IP ProtocolOpen SQL Server Configuration ManagerExpand "SQL Server Network Configuration" and click on "Protocols for MSSQLSERVER"Right click on "TCP/IP" and choose "Enable"Click on "SQL Server Services"Right click on "SQL Server (MSSQLSERVER)" and choose "Restart" Enable TCP/IP Port for SQL Servernetsh advfirewall firewall add rule name=SQLPort dir=in protocol=TCP action=a..
Building Connector/C++ Applications on Windows with Microsoft Visual Studio Directory Structure From https://dev.mysql.com/downloads/connector/cpp/8.0.htmlDownload mysql-connector-c++-8.0.11-windows-x86-64bit.zip fileExtract to $(SolutionDir)connector folder $(SolutionDir)CppConnector$(SolutionDir)connector\include$(SolutionDir)connector\lib64\vs14 Visual Studio Change the build configuration fr..
// Dynamic Memory Allocation : TCHAR *myString #include #include #include #include int _tmain(){ TCHAR *myString; myString = new TCHAR[8]; //_stprintf(myString, _T("%s"), _T("1234567")); wsprintf(myString, _T("%s"), _T("1234567")); _tprintf(_T("String : %s \n"), myString); _tprintf(_T("Length : %d \n"), _tcslen(myString)); delete[] myString; return 0;}
enum type을 iteration하려면 어떻게 해야할까? 예를 들어서 아래와 같이 일주일의 요일이 담긴 emun type인 Days가 있다고 하자.enum Days { Sun, Mon, Tue, Wed, Thu, Fri, Sat }; Days를 iteration하여 아래와 같이 출력하려고 한다. Sun Mon Tue Wed Thu Fri Sat어떻게 해야할까? Enum.GetValues()를 이용하여, 아래와 같이 해주면 된다.Type type = typeof(Days); Array array = Enum.GetValues(type); foreach (var value in array) { Console.WriteLine(value); } Environment.SpecialFolder enum typ..
Vim, Emacs, AStyle 같은 프로그램에서 사용하는 option 파일인 _vimrc, .emacs, .astylerc 파일을 사용하기 위해서 %HOME% 환경변수를 지정해보자. 아래와 같이 지정해주면 편리하다. SET HOME=%USERPROFILE% http://hidecode.tistory.com/546http://hidecode.tistory.com/1220