본문 바로가기

프로그래밍29

visual studio 파일 저장시 utf8로 저장되게 하는방법 및 white space 제거 출처 : http://nving.tistory.com/66 출처 : http://ko.w3support.net/index.php?db=so&id=82971 매크로 에디트에 가서 MyMacros 에 EnvironmentsEvents에 아래와 같이 추가한다. MakeUTF8File 함수는 파일이 저장된후 utf8검사해서 인코딩 변경해서 저장을 다시한다. DelWhiteSpaceEndOfLine 함수는 파일의 각 라인 끝에 white space 제거한다. Imports System.IO Sub MakeUTF8File(ByVal path As String) Dim input As New FileStream(path, FileMode.Open) 'Check BOM Dim isUTF8 As Boolean = (in.. 2011. 10. 4.
Python 에서 xml 사용하기. element tree 를 사용.. Python 에서 xml 사용하기. element tree 를 사용.. 파이썬 홈페이지 http://www.python.org/ element tree 페이지. (python 3.2) http://docs.python.org/py3k/library/xml.etree.elementtree.html ----------------------------------- xml 파일 내용... ----------------------------------- #-*- coding: utf-8 -*- import os from xml.etree.ElementTree import ElementTree tree = ElementTree() tree.parse('test.xml') ### root root = tree.get.. 2011. 8. 19.
Python 삼항연산자 사용방법.. C 스타일 var = condition ? true : false; Python 스타일 ( 2.5 버전 이상부터 가능하다고 한다. 확인해 보진 않았음. ) var = True if condition else False condition이 참이면 앞의 변수사용 condition이 거짓이면 뒤의 변수사용 C 스타일과 순서가 다르고 기호가 아닌 조건문이 들어간다. C : 1 ? 2 : 3 Python : 2 if 1 else 3 2011. 8. 18.
Replacement new 메모리 할당 없이 생성자 호출하기.. Replacement new 메모리 할당 없이 생성자 호출하기.. 직접 관리하는 메모리에 클래스 등을 넣고 생성자만 호출하기위해 사용한다. #include class TestClass { public: TestClass(int num) { mNum = num; } ~TestClass() { } private: int mNum; } void test() { static char buffer[sizeof(TestClass)]; new(buffer) TestClass(1); } 2011. 7. 26.