Monday, April 13, 2009

How To Fill A Ziploc Bag With Hcl And Naking Soda

Compile VTK in python with Windows

Based on these instructions , I created a guide to compile the library VTK for Python under Windows.
 
1) Download and install:
  • CMake
  • Visual C + + Express (2008)
  • Python
 
2) Download the source files to vtk and extract them in a folder (for example VTK_SOURCE).
 
3) Create a new folder where to put the compiled files (eg BUILD).
 
4) Run CMake.
 
5) Set fields:
  • Where is the source code = VTK_SOURCE.
  • Where to build the binaries = BUILD.
 
6) Click on Configure and choose compiler as "Visual C 9 (2008)" .
 
7) Set the values:
  • VTK_WRAP_PYTHON = ON.
  • BUILD_SHARED_LIBS = ON.
 
8) Click on Configure.
 
9) If there are problems to solve, and click Configure each time. Here I report what I've encountered and solutions:
  • CMake Error at CMake/vtkWrapTcl.cmake:180 (MESSAGE): Tk was not found. Install the Tk development package (see http://tcl.tk or ActiveState Tcl) and set the appropriate variables (TK_INCLUDE_PATH, TK_LIBRARY, TK_WISH) or disable VTK_USE_TK. Call Stack (most recent call first): CMakeLists.txt:831 (INCLUDE).
  1. Abilitare la visualizzazione dei valori avanzati.
  2. Impostare VTK_USE_TK a OFF.
  • *CMake Error: The following variables are used in this project, but they are set to NOTFOUND.Please set them or make sure they are set and tested correctly in the CMake files: PYTHON_INCLUDE_PATH (ADVANCED). used as include directory in directory C:/Users/Giuseppe/Desktop/Nuova cartella/vtk-5.2.1.
  1. Abilitare la visualizzazione dei valori avanzati.
  2. Impostare PYTHON_INCLUDE_PATH alla cartella include presente nella cartella di Python (es.: C:/Python26/include).
  • *CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: PYTHON_LIBRARY (ADVANCED).
  1. Abilitare la visualizzazione dei valori avanzati.
  2. Set the file PYTHON_LIBRARY
  3. pythonXX.lib Python libs in the directory (eg C: / Python26/libs/python26.lib).
 
10) Click on OK when everything goes well.
 
11) Open the file in the folder INSTALL.vcproj build with Visual C + +.
 
12) From the Project menu, click Properties and then Configuration Manager and set the active configuration to Release.
 
13) Debug menu, click Start Debugging or F5.
 
14) Wait until the build (it may take a bit 'of time).
 
At this point I was able to build using Python25, while Python26 the 64-bit Visual Basic does not find definitions of entry points Python.

Wednesday, April 8, 2009

Sounf Blaster Mb Lizens Schlüssel

Dependencies Python 4 - GetClasses & GetFunctions

We come now to write code that uses the basic functions to get all classes and all functions: GetClasses and GetFunctions. Are very similar in structure because the result of taking TrovaNelFile and apply getClass, GetPublicFunction and GetClassFunction to get classes and functions. Let's see how:
 
final GetClasses (inds, lines): # Find the classes classes = {} # inds are the result of TrovaNelFile ('class') f or us in inds: # lines are all lines # file we are reading cl = getClass (lines [us]) # If the class is added to a dictionary # if cl! =- 1: classes [cl] = (us, []) return classes
 
def GetFunctions (inds, lines): # Find function # initialize a two dictionaries for the functions # within classes and one for external funcs, pfuncs ={},{} # inds are the result of TrovaNelFile ('def') f or fi in inds: # lines are all lines # file we are reading GetPublicFunction pf = ( lines [fi]) # if is an external function adds if pf! =- 1: pfuncs [pf] = fi # otherwise look for an internal else: cf, col = GetClassFunction (lines [fi]) # if is an internal function adds if cf! =- 1: funcs [fi] = (cf, col, []) return pfuncs, funcs
For this time is all hello to everyone at the near post and comment many:).
TrovaNelFile getClass
Last

Saturday, April 4, 2009

Gosser Product Snowboard

dependencies in Python 3 - 2 GetFunction

basic function: GetFunctionClass , you need to get the name of the functions belonging to a class (ie indented)
 
final GetClassFunction (line): # Find 'def' need for space and a spazio.Lo # avoid false positives, such as' def'inizione line.find start = (" final ( final ) # The next two lines are used to create a string # full of start spaces txt = "" txt = txt.ljust (start, " ") # Check if before 'def' there are only spaces if line [: start] == \u200b\u200btxt: # Search the open parenthesis line.find end = (( ") # Check that the function is not empty if line [start +4: ]!='': end # Returns the function name and the column return line [start +4: end], start # Returns -1, -1 if the function name is empty else: return -1, -1 # Returns -1, -1 if before 'def' is something else maybe # 'def' is written in a comment else : return -1, -1
I leave you to write code to get a line of text from an external function to classes. If you have any problems comment!
TrovaNelFile
getClass