기본 콘텐츠로 건너뛰기

8월, 2009의 게시물 표시

mod_wsgi+python3.1

http://code.google.com/p/pywxml/wiki/mod_wsgi python 3.1을 사용하기 위해서는 현재(2009.8.24) 개발버전을 checkout 한 후 win32-ap22py31.mk의 내용을 다음과 같이 수정합니다. checkout svn checkout http ://modwsgi.googlecode.com/svn/trunk/ modwsgi-read-only 수정 CPPFLAGS = \ / DWIN32 \ / DNDEBUG \ / DMOD_WSGI_ENABLE_PY3K \

ie는 <meta http-equiv="content-type" content="text/html;charset=utf-8" />를 모른다?

윈도 ie는 헤더 파일에 설정된 <meta http-equiv="content-type" content="text/html;charset=utf-8" /> 태그를 인식하지 못하네요. 아파치를 사용한다면 http.conf에서 AddDefaultCharset utf-8 을 추가하면 되지만 모든 문서의 인코딩이 utf-8 아니라면 스크립팅 언어에서 설정도 가능합니다. php> <?php header('Content-Type: text/html; charset=UTF-8'); ?>

xsl을 사용하여 html tag를 그대로 브라우저로 출력하기

xml내용          <content>          <![CDATA[              <img src="../PIC10.gif" width="103" height="32" border="0" />의 값은? <img src="../PIC11.gif"/>ddd          ]]>          </content> xsl내용 <xsl:template  match = "content" >      <xsl:value-of  select = "."  disable-output-escaping = "yes" /> <br  /> </xsl:template> disable-out-escaping="yes" 를 사용하면 가능합니다. 출력결과 IE FF FF에서는 작동하지 않는군요...ㅜㅜ 왜 그럴까요?

xslt와 xsd가 적용된 exam

<? xml  version = "1.0"  encoding = "utf-8" ?>  <? xml-stylesheet  type = "text/xsl"  href = "/xsl/exam.xsl" ?> <exam xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.w3schools.com exam.xsd" >   <questions>       <question>           다음 중 옳은 것은?           <example>               1.           </example>           <example>               1.           </example>           <answer>               1.           </answer>           <solution>               따라서...           </solution>       </question>  </questions>  </exam>  아래 게시물들의 <exam xmlns="http://www.w3schools.com" 부분은 제대로 동작하지 않습니다.

exam xslt

<? xml  version = "1.0"  encoding = "utf-8" ?> <xsl:stylesheet  version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" > <xsl:template  match = "/" >      <html>          <header></header>          <body>              <xsl:apply-templates  />          </body>      </html> </xsl:template> <xsl:template  match = "questions" >      <table>          <tr><td> aa </td></tr>          <tr><td><xsl:apply-templates  select = "question"  /> </td></tr>      </table> </xsl:template> <xsl:template  match = "question" >      <xsl:apply-templates  select = "example"  />      <xsl:apply-templates  select = "answer"  />      <xsl:apply-templates  select = "solution"  /> </xsl:template> <xsl:template  match = &

element type을 따로 지정한 xsd

<? xml  version = "1.0" ?> <xs:schema  xmlns:xs = "http://www.w3.org/2001/XMLSchema" targetNamespace = "http://www.w3schools.com" xmlns = "http://www.w3schools.com" elementFormDefault = "qualified" > <xs:element  name = "exam" >    <xs:complexType>      <xs:sequence>        <xs:element  name = "questions"  type = "questionsType"  />      </xs:sequence>    </xs:complexType> </xs:element> <xs:complexType  name = "questionsType"  mixed = "true" >      <xs:sequence>          <xs:element  name = "question"  type = "questionType"  maxOccurs = "unbounded" />      </xs:sequence> </xs:complexType> <xs:complexType  name = "questionType"  mixed = "true" >      <xs:sequence>          <xs:element  name = "example"  type = "xs:string" 

XSD How To?

XSD How To? XML문서는 DTD나 XML스키마를 참조할 수 있다. exam.xml <?xml version="1.0"?> <exam> <questions>     <question>         다음 중 옳은 것은?         <example>             1.         </example>         <example>             1.         </example>         <answer>             1.         </answer>         <solution>             따라서...         </solution>     </question> </questions> </exam> exam.dtd <!ELEMENT exam (questions+)> <!ELEMENT questions (question*)> <!ELEMENT question (#PCDATA|example|answer|solution)*> <!ELEMENT example (#PCDATA)> <!ELEMENT answer (#PCDATA)> <!ELEMENT solution (#PCDATA)> exam.xsd <? xml  version = "1.0" ?> <xs:schema  xmlns:xs = "http://www.w3.org/2001/XMLSchema" targetNamespace = "http://www.w3schools.com" xmlns = "http://www.w3schools.com" elementFormDefault = "qualified" > <

XML스키마 소개

Introduction to XML Schema 1. XML Schema란? XML Schema는 XML 기반의 DTD대안이다. XML schema는 XML문서의 구조를 설명한다. XML Schema 언어는 XML Schema Definition (XSD)이라고도 불린다. 2.필요한 사전지식: HTML / XHTML XML and XML Namespaces DTD에 대한 기본적인 이해 3. An XML Schema: 문서에나타날수 있는 elements를 정의한다. 문서에나타날수 있는 attribute를 정의한다. 어떤 elements가 자식 elements인지 정의한다. 자식 elements의 순서를 정의한다. 자식 elements의 수를 정의한다. element가 비어있는지 또는 텍스트를 가질 수있는 지를 정의한다. elements와 attributes의 data type을 정의한다. elements와 attributes의 기본,정해진 값을 정의한다.

mod_python 3.3.1

mod_python홈 설치후 아파치 설정에 다음 라인을 추가 후 재시작. LoadModule python_module modules/mod_python.so psp를 사용하기 위해서는 다음 라인도 추가 AddHandler mod_python .psp PythonHandler mod_python.psp

윈도우용 libxml, libxslt

뭐하나 하려면 참 복잡하네요... 파이썬에서 xml을 처리하려고 하는데, 괜히 파이썬을 최신버전으로 설치했다가..ㅜㅜ 최신버전용 패키지들은 아직 없는 것들이 많다는... http://xmlsoft.org/sources/win32/ 에서 바이너리 배포파일을 찾을 수 있습니다.

Installing setuptools

installing setuptools 안정적인 버전의 setuptool을 설치하려면 EasyInstall Installation Instructions 을 참조하세요. 파이썬 기본 디렉토리이외에 설치하려면 Custom Installation Locations 부분을 참조하시면 됩니다. 개발버전을 설치하려면 일단 안정버전을 설치한 후 다음을 실행하세요. ez_setup.py setuptools==dev 이 명령은 Python Subversion sandbox에서 개발버전을 다운로드해서 설치합니다.

python sqlite3 db 생성하기

python-sqlite3.html import  sqlite3 # test db(file name) # :memory: means RAM db  =  '''test_db''' sql_t_person  =  '''create table person (name text)''' def  main ():      con  =  sqlite3 . connect ( db )      con . isolation_level  =  None  # autocommit      cur  =  con . cursor ()      # create test_db      cur . execute ( sql_t_person )      cur . close ()      return  0 if  __name__  ==  '__main__' :  main ()

한줄 입력을 Text widget에 출력-grid를 이용

from  tkinter  import  * class  mDialog :      def  __init__ ( self ,  master ):          frame  =  Frame ( master )          frame . pack ()                   #출력을 위한 Text 위젯          self . textbox  =  Text ( frame ,  width = 50 ,  height = 5 )          self . textbox . grid ( row = 0 ,  columnspan = 2 )                   #한줄 입력을 위한 위젯, Entry          self . input  =  Entry ( frame ,  width = 50 )          self . input . grid ( row = 1 ,  column = 0 )                   self . button  =  Button ( frame ,  text = "입력" ,  command = self . output )          self . button . grid ( row = 1 ,  column = 1 )               def  output ( self ):                   #Entry.get()          #입력받은 내용을 출력          self . textbox . insert ( END , self . input . get ())          def  main ():           root  =  Tk ()      app  =  mDialog ( root )      root . mainloop () if  __name__  ==  '__main__' :  main ()

tkinter한줄 입력받아 출력하기

from tkinter import * class App: def __init__(self, master): frame = Frame(master) frame.pack() #한줄 입력을 위한 위젯, Entry self.input = Entry(frame) self.input.pack(side=LEFT) self.button = Button(frame, text="입력", command=self.output) self.button.pack(side=LEFT) def output(self): #입력받은 내용을 출력 #Entry.get() print(self.input.get()) def main(): root = Tk() app = App(root) root.mainloop() if __name__ == '__main__': main()

python tkinter "Hello, world!"

python3.1 from tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() root.mainloop() 결과는 다음과 같습니다.^^ 파이썬 2대에서 모듈명의 첫 대문자 T가 소문자t로 바뀌었습니다.

작업관리자 창이 이상해졌다..ㅜㅜ

헐...이게 왠일 윈도 작업관리자 창이 이상해졌습니다. 요렇게..ㅠㅜ 재부팅등등...몇 시간을 삽질하다.... 인터넷을 뒤졌습니다. 뭐 나같이 한심한 상황을 당한 사람이 있을 거라 생각하지 않아서...첨부터 검색을 안했던 건데...ㅋㅋ 역시나 있더군요... http://smilecap.tistory.com/321 그림에서 테두리 부분을 더블클릭하면 된다는 글을 발견... 역시나 되는 군요...^^;;;