You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(44) |
Feb
(151) |
Mar
(131) |
Apr
(171) |
May
(125) |
Jun
(43) |
Jul
(26) |
Aug
(19) |
Sep
(10) |
Oct
|
Nov
(4) |
Dec
(28) |
2004 |
Jan
(134) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ki...@us...> - 2003-03-14 22:30:39
|
Update of /cvsroot/pymerase/pymerase/examples/selfRefObj In directory sc8-pr-cvs1:/tmp/cvs-serv31937 Added Files: createapi.py Log Message: dbapi --- NEW FILE: createapi.py --- #!/usr/bin/env python import sys import os import pymerase # NOTE: Jython can't use the python way to load modules based on their name # NOTE: so we have to manually import the modules we're using # NOTE: and pass them to pymerase.run import pymerase.input.parseXMI import pymerase.output.CreateDBAPI if __name__ == "__main__": schema = os.path.abspath("./selfRefObj.xmi") outputPath = os.path.abspath("./SelfRefAPI") #pymerase.run(schema, 'parseXMI', output, 'CreateDBAPI') pymerase.run(schema, pymerase.input.parseXMI, outputPath, pymerase.output.CreateDBAPI) |
From: <ki...@us...> - 2003-03-14 22:30:24
|
Update of /cvsroot/pymerase/pymerase/examples/selfRefObj In directory sc8-pr-cvs1:/tmp/cvs-serv31751 Added Files: Makefile Log Message: extract .xmi file --- NEW FILE: Makefile --- selfRefObj.xmi: unzip selfRefObj.zargo selfRefObj_.xmi mv selfRefObj_.xmi selfRefObj.xmi |
From: <ki...@us...> - 2003-03-14 22:29:59
|
Update of /cvsroot/pymerase/pymerase/examples/selfRefObj In directory sc8-pr-cvs1:/tmp/cvs-serv31546 Added Files: selfRefObj.zargo Log Message: Self Referencing Object example --- NEW FILE: selfRefObj.zargo --- (This appears to be a binary file; contents omitted.) |
From: <ki...@us...> - 2003-03-14 22:29:28
|
Update of /cvsroot/pymerase/pymerase/examples/selfRefObj In directory sc8-pr-cvs1:/tmp/cvs-serv31426/selfRefObj Log Message: Directory /cvsroot/pymerase/pymerase/examples/selfRefObj added to the repository |
From: <ki...@us...> - 2003-03-14 03:57:52
|
Update of /cvsroot/pymerase/pymerase/examples/linkDB In directory sc8-pr-cvs1:/tmp/cvs-serv31094 Modified Files: linker.py Log Message: corrected var name Index: linker.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/examples/linkDB/linker.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** linker.py 5 Mar 2003 02:30:32 -0000 1.4 --- linker.py 14 Mar 2003 03:16:03 -0000 1.5 *************** *** 205,209 **** #save a backup copy of the file as fileName.bak ! f = open(filename + '.bak', 'w') f.write(fileData) f.close() --- 205,209 ---- #save a backup copy of the file as fileName.bak ! f = open(fileName + '.bak', 'w') f.write(fileData) f.close() |
From: <ki...@us...> - 2003-03-14 03:44:02
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv9031 Modified Files: linkdb-tutorial.tex Log Message: Finished first draft of the tutorial Index: linkdb-tutorial.tex =================================================================== RCS file: /cvsroot/pymerase/Docs/linkDB-tutorial/linkdb-tutorial.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** linkdb-tutorial.tex 13 Mar 2003 02:30:14 -0000 1.4 --- linkdb-tutorial.tex 14 Mar 2003 03:43:59 -0000 1.5 *************** *** 9,16 **** --- 9,18 ---- \usepackage{graphicx} \usepackage{color} + \usepackage[margin=3cm,noheadfoot]{geometry} %\usepackage{makeidx} \setlength{\parindent}{0in} \setlength{\parskip}{2mm} + %\setlength{\textwidth}{6.5in} %colors *************** *** 31,35 **** \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.4\\\today} \maketitle \thispagestyle{empty} --- 33,37 ---- \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.5\\\today} \maketitle \thispagestyle{empty} *************** *** 102,107 **** \section{\cb Getting Help} \subsection{\cb Pymerase Web Site} ! One of the first places you should check out if you need help is the ! Pymerase web site at \pymlink. Most of the documentation you will need, if it's available, will be in the Docs section of the web site. --- 104,109 ---- \section{\cb Getting Help} \subsection{\cb Pymerase Web Site} ! One of the first places you should visit if you need help is the ! Pymerase web site\footnote{\pymlink}. Most of the documentation you will need, if it's available, will be in the Docs section of the web site. *************** *** 350,354 **** You may wish to generate other output modules in addition to the four used in this tutorial. For a complete list of Output modules, visit ! the Pymerase Docs - Output Modules web page\footnote{http://pymerase.sf.net/docs/output/}. --- 352,357 ---- You may wish to generate other output modules in addition to the four used in this tutorial. For a complete list of Output modules, visit ! the Pymerase Docs - Output Modules web ! page\footnote{http://pymerase.sf.net/docs/output/}. *************** *** 400,406 **** database. ! Here is a quick example of how to use the DBAPI\footnote{Check the pymerase ! docs or e-mail the mailing list mentioned in section \ref{pymdevel} ! for more help.}. \begin{verbatim} --- 403,409 ---- database. ! Here is a quick example of how to use the DBAPI\footnote{Check the ! pymerase docs or e-mail the mailing list mentioned in section ! \ref{pymdevel} for more help.}. \begin{verbatim} *************** *** 487,491 **** \end{verbatim} ! \subsection{\cb CreatePyTkDBWidgets} Excute the following command to generate the Python Tkinter Database Widget library for your schema. --- 490,494 ---- \end{verbatim} ! \subsection{\cb CreatePyTkDBWidgets}\label{pytkdb} Excute the following command to generate the Python Tkinter Database Widget library for your schema. *************** *** 570,574 **** \end{verbatim} ! %continue here \end{document} --- 573,988 ---- \end{verbatim} ! Unless you configured the db.cfg file mentioned in section ! \ref{pytkdb}, you should see the generic database connection widget ! shown in Figure~2. ! ! \begin{figure}[h] ! \centering ! \includegraphics{images/dbConnect-widget.eps} ! \caption{\cb Generic Database Connection Widget} ! \end{figure} ! ! If you are using the widget on the same computer as the database, use ! 'localhost' as the host. Otherwise you can enter a domain name or ip ! address and it should work as long as the database has been configured ! to except external connections. Enter the database name that we used ! when creating the database 'linkdb' and then enter your username and ! password if needed. ! ! Once you've connected to the database, you should be able to add ! groups to your database. These groups will define groups of links you ! will use for a specific web site. Enter 'tutorial' in for the name of ! the first group as shown in Figure~3 and then press the 'Save' button. ! ! \begin{figure}[h] ! \centering ! \includegraphics{images/groupdb-widget2.eps} ! \begin{verbatim} ! |<< First Record >>| Last Record ! |< Previous Record >| Next Record ! >* New Record ! \end{verbatim} ! \caption{\cb Group Database Widget} ! \end{figure} ! ! Close the GroupDbWidget and then execute the following command to load ! up the NameLinkPair Entry Widget. ! ! \begin{verbatim} ! python ./NameLinkPairDbWidget.py ! \end{verbatim} ! ! Connect to the database using the generic connection widget and then ! we are ready to add Name Link Pairs and associate them with a ! group. Later on we will create a simple web page with the following ! keywords on it. ! ! \begin{tabular}{ll} ! \bf Keyword & \bf URL \\ ! pymerase & http://pymerase.sf.net \\ ! postgresql & http://www.postgresql.org \\ ! python & http://www.python.org ! \end{tabular} ! ! For each of the Name Link Pairs, enter them in to the database as ! shown in Figure~4. After typing each entry, press the save button and ! then the 'New Record' button shown in Figure~3. ! ! \begin{figure}[h] ! \centering ! \includegraphics{images/nameLinkPairDb-widget.eps} ! \caption{\cb Generic Database Connection Widget} ! \end{figure} ! ! \section{\cb Tutorial: Command Line Program} ! ! \subsection{\cb Creating the Program} ! Once the data has been entered into the database, it's time to make ! the command line program which you will use. You can use the linker.py ! file included in the linkDB example included with Pymerase, or you can ! reference the same program in the appendix on page ! \pageref{cmdline}. Or if your really daring, you can right it yourself ! from scratch. ! ! If you decide to use the appendix or example code provided, the python ! code is commented and should be fairly self explanitory. If you don't ! agree or you run into problems, posts the mailing list mentioned in ! section \ref{pymdevel} are always welcome. ! ! \subsection{\cb linker.py Useage}\label{cmdhelp} ! The following is a print out of the instructions you get when you ! run: ! ! \begin{verbatim} ! python ./linker.py --help ! \end{verbatim} ! ! \begin{verbatim} ! Linker.py: ! Looks for names in an html file that matches the database ! and replaces them with a link. ! ! Useage: ! linker.py [options] -g group -f file ! ! linker.py [options] --group=group --file=file ! ! ! Options: ! -h, --host=foo Name of host. Default: localhost ! -d, --database=foo Name of database. Default: linkdb ! -u, --user=foo User login for DB. Default: ENV USERNAME ! -p, --password=foo User password for DB. Default: None ! ! -g, --group=foo Name of group to use for processing ! -f, --file=foo File to be processed ! ! -h, --help Displays this help page ! \end{verbatim} ! ! \section{\cb Tutorial: Testing The Program} ! ! \subsection{\cb Prepare the HTML File} ! Before we can test the program we need an html file to use. Create a ! new text file called 'tutorial.html' and paste in the html ! code below. ! ! %\begin{figure}[h] ! \begin{verbatim} ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ! ! <html> ! <head> ! <title>linkDB Tutorial</title> ! </head> ! <body> ! Pymerase<br> ! Postgresql<br> ! Python<br> ! </body> ! </html> ! \end{verbatim} ! ! \subsection{\cb Process the HTML File} ! The big question... is it going to work? Remember, linker.py is case ! sensitive, so 'Pymerase' is different than 'pymerase'. If you'd like ! to expand on this example, making an option for ignoring case would be ! good thing to do. ! ! You may want to reference section \ref{cmdhelp} when executing the ! following command. You may wish to change the options based on your ! database setup. ! ! \begin{verbatim} ! python ./linker.py -h localhost -d tutorial -u king -g tutorial -f tutorial.html ! \end{verbatim} ! ! In case something went wrong, the program makes a backup of your ! 'tutorial.html' file in a file called 'tutorial.html.bak'. ! ! The end result if everything went well should look like the following. ! ! \begin{verbatim} ! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ! ! <html> ! <head> ! <title>linkDB Tutorial</title> ! </head> ! <body> ! <a href="http://pymerase.sf.net">Pymerase</a><br> ! <a href="http://www.postgresql.org">Postgresql</a><br> ! <a href="http://www.python.org">Python</a><br> ! </body> ! </html> ! \end{verbatim} ! ! \section{\cb Making Pymerase Better} ! ! \subsection{\cb How You Can Help} ! If you have an questions, comments, ideas, spelling corrections etc., ! please voice your comments. Open Source projects strive on feedback ! from the community. If you would like to contibute to any part of the ! project, please send a message to the mailing list mentioned in section ! \ref{pymdevel}. We could use all the help we can get. =o) ! ! \pagebreak ! \section{\cb APPENDIX} ! %\appendix ! \subsection{\cb Command Line Program} \label{cmdline} ! \begin{verbatim} ! #!/usr/bin/env python ! ########################################################################### ! # # ! # C O P Y R I G H T N O T I C E # ! # Copyright (c) 2003 by: # ! # * California Institute of Technology # ! # # ! # All Rights Reserved. # ! # # ! # Permission is hereby granted, free of charge, to any person # ! # obtaining a copy of this software and associated documentation files # ! # (the "Software"), to deal in the Software without restriction, # ! # including without limitation the rights to use, copy, modify, merge, # ! # publish, distribute, sublicense, and/or sell copies of the Software, # ! # and to permit persons to whom the Software is furnished to do so, # ! # subject to the following conditions: # ! # # ! # The above copyright notice and this permission notice shall be # ! # included in all copies or substantial portions of the Software. # ! # # ! # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # ! # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # ! # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # ! # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS # ! # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # ! # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # ! # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # ! # SOFTWARE. # ! ########################################################################### ! # ! # Authors: Brandon King ! # Last Modified: $Date$ ! # ! ! ! ! import os ! import sys ! import getopt ! import re ! ! from LinkAPI import DBSession ! ! def parseCommandLine(): ! """ ! Processes Command Line Arguments ! ! return (groupName, fileName, dsn, database, user, password) ! """ ! ! #Set default values for command line ! groupName = None ! fileName = None ! dsn = "localhost" ! database = "linkdb" ! try: ! user = os.environ["USERNAME"] ! except: ! user = None ! password = None ! ! try: ! #define command line args ! opts, args = getopt.getopt(sys.argv[1:], "h:d:u:p:g:f:", ! ["host", ! "database=", ! "user=", ! "password=", ! "group=", ! "file=", ! "help"]) ! except getopt.GetoptError: ! print "-------------------------------" ! print "- Invalid Command Line Option -" ! print "-------------------------------" ! printUseage() ! sys.exit(2) ! ! if len(sys.argv) <= 1: ! printUseage() ! sys.exit(2) ! ! for arg, val in opts: ! ! #Display Help ! if arg in ('--help', '--help'): ! printUseage() ! sys.exit() ! ! #Set the group name to use when accessing the database ! if arg in ('-g', '--group'): ! groupName = val ! ! #Set files name to use ! if arg in ('-f', '--file'): ! fileName = val ! ! #host to connect to. Default = localhost ! if arg in ('-h', '--host'): ! dsn = val ! ! #name of database. Default = linkdb ! if arg in ('-d', '--database'): ! database = val ! ! #user name. Default = $USERNAME environment var ! if arg in ('-u', '--user'): ! user = val ! ! #password. Default = None ! if arg in ('-p', '--password'): ! password = val ! ! msg = "" ! if groupName is None: ! msg += "Error: No group provided" ! msg += os.linesep ! if fileName is None: ! msg += "Error: No file provided" ! msg += os.linesep ! if msg != "": ! msg += "Suggestion: see \'linker.py --help\'" ! msg += os.linesep ! print msg ! sys.exit(2) ! ! ! return (groupName, fileName, dsn, database, user, password) ! ! def printUseage(): ! """ ! Prints the useage information ! """ ! useage = """ ! Linker.py: ! Looks for names in an html file that matches the database ! and replaces them with a link. ! ! Useage: ! linker.py [options] -g group -f file ! ! linker.py [options] --group=group --file=file ! ! ! Options: ! -h, --host=foo Name of host. Default: localhost ! -d, --database=foo Name of database. Default: linkdb ! -u, --user=foo User login for DB. Default: $USERNAME ! -p, --password=foo User password for DB. Default: None ! ! -g, --group=foo Name of group to use for processing ! -f, --file=foo File to be processed ! ! -h, --help Displays this help page ! ! """ ! ! print useage ! ! def getFileData(fileName): ! """ ! opens file if exists ! returns data ! """ ! ! if os.path.isfile(fileName): ! f = open(fileName, 'r') ! data = f.read() ! f.close() ! return data ! else: ! "Invalid file name \"%s\"" % (fileName) ! return None ! ! ! if __name__ == '__main__': ! #retrive command line arguments if valid ! groupName, fileName, dsn, database, user, password = parseCommandLine() ! ! #set fileName to absolute path ! fileName = os.path.abspath(fileName) ! ! #Connects, or dies... Good luck! ! dbs = DBSession(dsn=dsn, database=database, user=user, password=password) ! ! #get the group object with a given name ! # this allows you to sort your links in groups ! groupList = dbs.getObjectsWhere(dbs.Group, 'name = \'%s\'' % (groupName)) ! ! #If you entered a name that doesn't exist (CASE sensitive), ! # the program quits ! if len(groupList) == 0: ! print "Group \"%s\" not found" % (groupName) ! sys.exit() ! ! #If one group exists ! if len(groupList) == 1: ! #get the group ! group = groupList.pop() ! #get all the links in the group ! linkerList = group.getNameLinkPair() ! ! #get the html file in string form for processing ! fileData = getFileData(fileName) ! ! #save a backup copy of the file as fileName.bak ! f = open(fileName + '.bak', 'w') ! f.write(fileData) ! f.close() ! ! ! print "Processing Links:" ! for nameLink in linkerList: ! name = nameLink.getName() ! url = nameLink.getUrl() ! ! print "%s\t%s" % (name, url) ! ! #replace keyword with link using regexp ! fileData = re.sub(name+"(?!</a>)", "<a href=\"%s\">%s</a>" % \ ! (url,name), ! fileData) ! ! #save html file ! f = open(fileName, 'w') ! f.write(fileData) ! f.close() ! ! else: ! print "%s groups with name %s!" % (len(groupList), groupName) ! sys.exit() ! \end{verbatim} ! \end{document} |
From: <ki...@us...> - 2003-03-13 02:30:18
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv12741 Modified Files: linkdb-tutorial.tex Log Message: continuing the tutorial Index: linkdb-tutorial.tex =================================================================== RCS file: /cvsroot/pymerase/Docs/linkDB-tutorial/linkdb-tutorial.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** linkdb-tutorial.tex 12 Mar 2003 06:53:17 -0000 1.3 --- linkdb-tutorial.tex 13 Mar 2003 02:30:14 -0000 1.4 *************** *** 31,35 **** \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.3\\\today} \maketitle \thispagestyle{empty} --- 31,35 ---- \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.4\\\today} \maketitle \thispagestyle{empty} *************** *** 93,96 **** --- 93,97 ---- \item Python Language\footnote{Python Tutorial: http://www.python.org/doc/current/tut/tut.html} + \item PostgreSQL \end{itemize} *************** *** 186,194 **** files, run the command below. ! \textcolor{blue}{unzip linkDB.zargo linkDB\_.xmi} If that command fails, try this command: ! \textcolor{blue}{unzip linkDB.zargo} You should find a .xmi file in your directory. This is the file which --- 187,199 ---- files, run the command below. ! \begin{verbatim} ! unzip linkDB.zargo linkDB_.xmi ! \end{verbatim} If that command fails, try this command: ! \begin{verbatim} ! unzip linkDB.zargo ! \end{verbatim} You should find a .xmi file in your directory. This is the file which *************** *** 264,267 **** --- 269,278 ---- 'pymerase.input.parseXMI' for the input module. + \subsection{\cb Todo for All Templates} + For each of the driver programs you will create .py file and paste in + the template from section \ref{template}. Changed the + schema path to the path were your .xmi file we extracted in section + \ref{xmi} and that you replace 'nameOfInputModule' with 'parseXMI'. + \subsection{\cb Create SQL for Database}\label{sql} *************** *** 303,310 **** \end{verbatim} ! \subsection{\cb Create Database API} The \textcolor{blue}{CreateDBAPI} output module is used to generate a Python Database API to the database you will generate from the SQL in section \ref{sql}. \end{document} --- 314,574 ---- \end{verbatim} ! \subsection{\cb Create Python Database API (DBAPI)} The \textcolor{blue}{CreateDBAPI} output module is used to generate a Python Database API to the database you will generate from the SQL in section \ref{sql}. + + Create a new file in your tutorial directory named 'createapi.py' + and paste in the driver program template from section + \ref{template}. Change the output path from './outputPath' to + './LinkAPI' and change 'nameOfOutputModule' to 'CreateDBAPI'. + + \subsection{\cb Create Python Tkinter Widgets} + The \textcolor{blue}{CreatePyTkWidgets} output module is used to + generate a library of Python Tkinter Widgets based on the schema + you used to generate the widgets. You would use this if you would + quickly like to create a GUI for your application. + + Create a new file in your tutorial directory named + 'createpytkwidgets.py' and paste in the driver program template from + section \ref{template}. Change the output path from './outputPath' to + './widgets' and change 'nameOfOutputModule' to 'CreatePyTkWidgets'. + + \subsection{\cb Create Python Tkinter Database Widgets} + The \textcolor{blue}{CreatePyTkDBWidgets} output module is used to + create a few more widgets to the library of Python Tkinter + Widgets. These widgets have been linked up to the DBAPI for your + database, and will allow you view, edit, and create new records in + your database. + + Create a new file in your tutorial directory named + 'createpytkdbwidgets.py' and paste in the driver program template from + section \ref{template}. Change the output path from './outputPath' to + './widgets' and change 'nameOfOutputModule' to 'CreatePyTkDBWidgets'. + + \subsection{\cb Other Output Modules} + You may wish to generate other output modules in addition to the four + used in this tutorial. For a complete list of Output modules, visit + the Pymerase Docs - Output Modules web page\footnote{http://pymerase.sf.net/docs/output/}. + + + + %Section: Generate Files with Pymerase + \section{\cb Tutorial: Generating Files with Pymerase} + + \subsection{\cb Description} + Now you should have at least the following files in your tutorial + directory. + + \begin{itemize} + \item linkDB.zargo + \item linkDB\_.xmi + \item createsql.py + \item createapi.py + \item createpytkwidgets.py + \item createpytkdbwidgets.py + \end{itemize} + + In this section we will generate all the files we will need to make + our command line program that will accomplish our goal from section + \ref{the_goal}. + + \subsection{\cb CreateSQL} + Time to create the sql for the database. Executed the following + command. + + \begin{verbatim} + jython ./createsql.py + \end{verbatim} + + If everything goes well, you should find a file called linkDB.sql in + your tutorial directory. If something goes wrong, you probably don't + have jython and/or pymerase setup correctly. Read the Pymerase + Installation Documentation\footnote{http://pymerase.sf.net/docs/} or + e-mail the pymerase-devel mailing list mentioned in section + \ref{pymdevel}. + + \subsection{\cb CreateDBAPI}\label{linkapi} + Now execute the following command to create the DBAPI. + + \begin{verbatim} + jython ./createapi.py + \end{verbatim} + + If everything went well, you should find a python package called + 'LinkAPI'. We will use this later to access the data from our + database. + + Here is a quick example of how to use the DBAPI\footnote{Check the pymerase + docs or e-mail the mailing list mentioned in section \ref{pymdevel} + for more help.}. + + \begin{verbatim} + #!/usr/bin/env python + + from LinkAPI import DBSession + + if __name__ == '__main__': + dbs = DBSession(dsn='localhost', + database='linkdb', + user='userName', + password=None) + + + #get all name link pairs + nameLinkPairList = dbs.getAllObjects(dbs.NameLinkPair) + + #get all groups + groupList = dbs.getAllObjects(dbs.Group) + + #get group with primary key of 1 + groupId1 = dbs.getObject(dbs.Group, '1') + + #get name link pairs with primary keys 1, 3, 4 + nlpKeys134 = dbs.getObject(dbs.NameLinkPair, + ['1', '3', '4']) + + #get group by database field 'name' + nameGroup = dbs.getObjectWhere(dbs.Group, 'name = \'myGroup\') + + #get NameLinkPairs associated with 'myGroup' + myGroup = nameGroup[0] + + nlp4myGroupList = myGroup.getNameLinkPair() + + \end{verbatim} + + + \subsection{\cb CreatePyTkWidgets} + Excute the following command to generate the Python Tkinter Widget + library for your schema. + + \begin{verbatim} + jython ./createpytkwidgets.py + \end{verbatim} + + You will be prompted for the name of the DBAPI package you want to use + with these widgets. In this case, you will enter 'LinkAPI'. + + If everything went well, you should have a directory named 'widgets' + in your tutorial directory. In that directory you should find the + following widgets. + + \begin{tabular}{ll} + ExtendedOptionMenu.py & Adds funtionality to OptionMenu widget.\\ + \emph{allOther}Widget.py & Entry Widgets for user entry of data.\\ + NavBar.py & Controls entry widget navigation.\\ + SaveWidget.py & Tells a given Entry Widget to save itself.\\ + ValidatingEntr.py & Adds validation to Tkinter Entry widgets.\\ + dbSession.py & Session Object for passing information around.\\ + & Also contains a generic DB connection widget.\\ + modes.py & Static variables for choosing widget mode. + \end{tabular} + + All \emph{allOther}Widget.py files can be executed to see if they were + contstructed properly. They don't do much in this state, but the have + functions for getting and setting the ValiditingEntrys. Each of + widgets can be subclassed and given save() and load() functions which + will then allow them to be hooked up to the SaveWidget and NavBar + widgets. In the next section we will generate Python Tkinter Database + Widgets which use these features. + + For more information on the entry widgets, please visit the Pymerase + Docs web site or send e-mail to the mailing list mentioned in section + \ref{pymdevel}. + + The widgets will need a copy of the LinkAPI package you generated in + section \ref{linkapi}. You can copy, move, or create a symbolic link + for this purpose. Excute the following command to copy the pakage from + your tutorial directory into the widget directory. + + \begin{verbatim} + cp -r LinkAPI/ widgets/ + \end{verbatim} + + \subsection{\cb CreatePyTkDBWidgets} + Excute the following command to generate the Python Tkinter Database + Widget library for your schema. + + \begin{verbatim} + jython ./createpytkwidgets.py + \end{verbatim} + + You will be prompted for the name of the DBAPI package you want to use + with these widgets. In this case, you will enter 'LinkAPI'. + + If all went well, you should find \emph{allOther}DbWidget.py files in + your widget directory. Each of these programs can be executed upon + creation. Each one if hooked up to the generic DB connection widget + and will prompt for infomation neccisary to connect to the + database. It can become annoying sometimes when you have to enter that + information every time you want to connect to the same database. So, + there is a 'db.cfg' file you can drop into the widget directory. Here + is an example. + + \begin{verbatim} + [Connect] + dsn: localhost + database: linkdb + user: userName + password: + \end{verbatim} + + If the connection to the database fails using the config file, it will + load the generic connection widget and load the config file values + into it. + + We will use these DbWidgets to input data into our database later in + the tutorial. + + + %Section: Setting Up the Database + \section{\cb Tutorial: Setting Up the Database} + + \subsection{\cb PostgreSQL Setup} + If you have not installed PostgreSQL 7.2 or higher, you should do so + now. If you have installed PostgreSQL and have configured it to your + liking, move on to the next section. If you get stuck, the mailing + list in section \ref{pymdevel} is there for you. + + \subsection{\cb Create the linkdb Database} + The first thing we need to do is create the linkdb database. If you + are running linux, you can use the following command. + + \begin{verbatim} + createdb -h localhost -U userName linkdb + \end{verbatim} + + If you get the message 'CREATE DATABASE', the command succeded. Next + you need to feed the SQL statements into the database to generate the + proper tables. User the following command. + + \begin{verbatim} + psql -h localhost -U userName linkdb < linkDB.sql + \end{verbatim} + + If you get the following message, everything went well. + + \begin{verbatim} + CREATE + NOTICE: CREATE TABLE / PRIMARY KEY will create implicit + index 'group_pkey' for table 'group' + CREATE + CREATE + NOTICE: CREATE TABLE / PRIMARY KEY will create implicit + index 'name_link_pair_pkey' for table 'name_link_pair' + CREATE + \end{verbatim} + + \subsection{\cb Input Data Using DB Widgets} + Now that we have our database, lets put some data in it for us to + use. Goto the widgets directory in your tutorial directory. Execute + the following command. + + \begin{verbatim} + python ./GroupDbWidget.py + \end{verbatim} + + %continue here \end{document} |
From: <de...@us...> - 2003-03-12 22:42:15
|
Update of /cvsroot/pymerase/pymerase/pymerase In directory sc8-pr-cvs1:/tmp/cvs-serv32232 Modified Files: ClassMembers.py Log Message: Used the wrong exception name, RangeError must've been from ada or something, python calles it an IndexError. Index: ClassMembers.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/pymerase/ClassMembers.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ClassMembers.py 12 Feb 2003 01:30:25 -0000 1.19 --- ClassMembers.py 12 Mar 2003 22:42:11 -0000 1.20 *************** *** 275,279 **** self.associationEnds.append(associationEnd) else: ! raise RangeError("Only allowed to have 2 AssociationEnd per Association") def removeAssociationEnd(self, associationEnd): --- 275,279 ---- self.associationEnds.append(associationEnd) else: ! raise IndexError("Only allowed to have 2 AssociationEnd per Association") def removeAssociationEnd(self, associationEnd): |
From: <ki...@us...> - 2003-03-12 06:53:20
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv14076 Modified Files: linkdb-tutorial.tex Log Message: updated with Tutorial: Prepare Driver Scripts section Index: linkdb-tutorial.tex =================================================================== RCS file: /cvsroot/pymerase/Docs/linkDB-tutorial/linkdb-tutorial.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** linkdb-tutorial.tex 8 Mar 2003 01:52:28 -0000 1.2 --- linkdb-tutorial.tex 12 Mar 2003 06:53:17 -0000 1.3 *************** *** 31,35 **** \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.2\\\today} \maketitle \thispagestyle{empty} --- 31,35 ---- \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.3\\\today} \maketitle \thispagestyle{empty} *************** *** 95,98 **** --- 95,102 ---- \end{itemize} + \subsection{\cb Optional Example Files} + All the files created in this tutorial can be found in the linkDB + example provided with pymerase. + \section{\cb Getting Help} \subsection{\cb Pymerase Web Site} *************** *** 101,105 **** need, if it's available, will be in the Docs section of the web site. ! \subsection{\cb Pymerase-devel Mailing List} Pymerase developers and users are using pymerase-devel at lists.sourceforge.net as a means of communication. If you need --- 105,109 ---- need, if it's available, will be in the Docs section of the web site. ! \subsection{\cb Pymerase-devel Mailing List}\label{pymdevel} Pymerase developers and users are using pymerase-devel at lists.sourceforge.net as a means of communication. If you need *************** *** 163,176 **** \caption{\cb LinkDB Schema in ArgoUML} \end{figure} ! Make sure you change the namespace property to 'LinkAPI' by clicking ! on the 'Group' class and then on the name space textbox. Then should ! be able to change the name. This is information that CreateDBAPI will ! use as the package name of your generated DBAPI. Note that if you change the names of the classes or attributes in this tutorial, you will have to do so throughout the whole tutorial. ! Create a director in you will work on this tutorial and save your ! ArgoUML file as linkDB.zargo. \end{document} --- 167,310 ---- \caption{\cb LinkDB Schema in ArgoUML} \end{figure} ! Make sure you change the namespace property to ! \textcolor{blue}{'LinkAPI'} by clicking on the 'Group' class and then ! on the name space textbox. Then should be able to change the ! name. This is information that \textcolor{blue}{CreateDBAPI} will use ! as the package name of your generated DBAPI. Note that if you change the names of the classes or attributes in this tutorial, you will have to do so throughout the whole tutorial. ! Create a directory in which you will work on this tutorial and save your ! ArgoUML file as \textcolor{blue}{linkDB.zargo}. ! ! \section{\cb Tutorial: Prepare Driver Scripts} ! ! \subsection{\cb Extract XMI File}\label{xmi} ! Pymerase cannot read the .zargo files created by ArgoUML, but it can ! read the .xmi files stored within the .zargo files. To extract the ! files, run the command below. ! ! \textcolor{blue}{unzip linkDB.zargo linkDB\_.xmi} ! ! If that command fails, try this command: ! ! \textcolor{blue}{unzip linkDB.zargo} ! ! You should find a .xmi file in your directory. This is the file which ! you are going to point pymerase to in a variable called 'schema' in ! the driver program in section \ref{template}. ! ! This is the reason why the input module for UML is called ! \textcolor{blue}{parseXMI} and not parseUML. ! ! ! \subsection{\cb Driver Program Template}\label{template} ! If you look at the documentation ''Pymerase Docs - Running Pymerase'', ! you will notice that there are three ways of running ! pymerase. Unfortunately, Pymerase, in it's current state only has one ! method of running pymerase using Jython. If for some reason you do ! not want to use jython or you want to use one of the other method for ! running pymerase, you use the table.dtd XML\footnote{If no ! documentation exist on the table.dtd XML format, please e-mail the ! mailing list mentioned in section \ref{pymdevel}.} ! (parseGenexSchemaXML input module) format to define your schema. ! ! Below you will find the Driver Program Template from ''Pymerase Docs - ! Running Pymerase'' ! ! %\pagebreak ! % BEGIN SNIP FROM 'PYMERASE DOCS - RUNNING PYMERASE' ! ------------Driver Program Template-----------\\ ! \color{red} ! \#!/usr/bin/env python ! ! \color{black} ! import sys\\ ! import os ! ! import pymerase ! ! \begin{tabbing} ! \color{red} ! \#In\=\color{red}put module to use (parseGenexSchemaXML.py would be\\ ! \color{red} ! \# \> \color{red} pymerase.input.parseGenexSchemaXML)\\ ! \color{black} ! import pymerase.input.\em nameOfInputModule \\ ! \\ ! \color{red} ! \#Output module to use (CreateDBAPI.py would\\ ! \color{red}\# \> \color{red} be pymerase.output.CreateDBAPI)\\ ! \color{black} ! import pymerase.output.\em nameOfOutputModule \\ ! \\ ! if \_\_name\_\_ == '\_\_main\_\_':\\ ! \> \color{red} \#Path to schema\\ ! \color{black} ! \>schema = os.path.abspath('../path2schema/schema') \\ ! \\ ! \> \color{red} \#Output Path\\ ! \color{black} ! \>outputPath = os.path.abspath('./outputPath')\\ ! \\ ! ! \> \color{red} \#Run pymerase\\ ! \color{black} ! \>pymerase.run(\=schema,\\ ! \> \>pymerase.input.\em nameOfInputModule,\\ ! \> \>outputPath,\\ ! \> \>pymerase.output.\em nameOfOutputModule) ! \end{tabbing} ! --------End Driver Program Template--------- ! % END SNIP FROM 'PYMERASE DOCS - RUNNING PYMERASE' ! ! For this tutorial, all driver programs will be using ! '.../path2schema/linkdb.xmi' for the schema variable and ! 'pymerase.input.parseXMI' for the input module. ! ! ! \subsection{\cb Create SQL for Database}\label{sql} ! The \textcolor{blue}{CreateSQL} output module is used to generate the ! SQL statements you need to create your database in PostgreSQL. ! ! Create a file in your tutorial directory called 'createsql.py' and ! paste in the template from section \ref{template}. Make sure you've ! changed the schema path to the .xmi file we extracted in section ! \ref{xmi} and that you replace 'nameOfInputModule' to 'parseXMI'. ! ! In addition to the changes above you have to make for all Driver ! Programs we will create, you need to change 'nameOfOutputModule' to ! 'CreateSQL' and the './outputPath' to './linkDB.sql'. ! ! Once you generate your linkDB.sql file later in the tutorial, it ! should look like the following: ! ! \begin{verbatim} ! CREATE SEQUENCE "group_pk_seq" start 1 increment 1 ! maxvalue 2147483647 minvalue 1 cache 1; ! ! CREATE TABLE "group" ( ! "group_pk" integer DEFAULT nextval('"group_pk_seq"'::text) ! PRIMARY KEY, ! "name" varchar(128) ! ) ; ! ! CREATE SEQUENCE "name_link_pair_pk_seq" start 1 increment 1 ! maxvalue 2147483647 minvalue 1 cache 1; ! ! CREATE TABLE "name_link_pair" ( ! "name_link_pair_pk" integer DEFAULT ! nextval('"name_link_pair_pk_seq"'::text) PRIMARY KEY, ! "name" varchar(128), ! "url" varchar(128), ! "group_fk" integer ! ) ; ! \end{verbatim} ! ! \subsection{\cb Create Database API} ! The \textcolor{blue}{CreateDBAPI} output module is used to generate a ! Python Database API to the database you will generate from the SQL in ! section \ref{sql}. \end{document} |
From: <ki...@us...> - 2003-03-12 06:26:57
|
Update of /cvsroot/pymerase/htdocs/about In directory sc8-pr-cvs1:/tmp/cvs-serv6453 Modified Files: index.shtml Log Message: forgot the ? Index: index.shtml =================================================================== RCS file: /cvsroot/pymerase/htdocs/about/index.shtml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** index.shtml 12 Mar 2003 06:26:04 -0000 1.6 --- index.shtml 12 Mar 2003 06:26:54 -0000 1.7 *************** *** 23,27 **** <tr> <td width="100%" bgcolor="#6C8AFF"> ! <u>Why is it called 'Pymerase'</u><br> Pymerase is the combination of 'Python', the primary language Pymerase is written in, and --- 23,27 ---- <tr> <td width="100%" bgcolor="#6C8AFF"> ! <u>Why is it called 'Pymerase'?</u><br> Pymerase is the combination of 'Python', the primary language Pymerase is written in, and |
From: <ki...@us...> - 2003-03-12 06:26:09
|
Update of /cvsroot/pymerase/htdocs/about In directory sc8-pr-cvs1:/tmp/cvs-serv6180 Modified Files: index.shtml Log Message: added the reason why Pymerase is called Pymerase Index: index.shtml =================================================================== RCS file: /cvsroot/pymerase/htdocs/about/index.shtml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** index.shtml 27 Feb 2003 20:35:44 -0000 1.5 --- index.shtml 12 Mar 2003 06:26:04 -0000 1.6 *************** *** 22,26 **** </tr> <tr> ! <td width="100%" bgcolor="#6C8AFF"><u>History:</u><br> Pymerase was originally designed and developed in the Caltech <a href="http://woldlab.caltech.edu/">Wold Lab</a>. The original --- 22,36 ---- </tr> <tr> ! <td width="100%" bgcolor="#6C8AFF"> ! <u>Why is it called 'Pymerase'</u><br> ! Pymerase is the combination of 'Python', the primary ! language Pymerase is written in, and ! 'Polymerase'. Polymerase, in short, is a molecule which ! copies/converts DNA into RNA. We figured that Pymerase had ! similar functionality in that it took table.dtd XML (DNA) files ! and converted them into other things, such as SQL statements ! (RNA) which is then used to create a database (Protein).<br> ! <br> ! <u>History:</u><br> Pymerase was originally designed and developed in the Caltech <a href="http://woldlab.caltech.edu/">Wold Lab</a>. The original *************** *** 32,37 **** <a href="http://mged.sourceforge.net/">MAGE</a>.<br> <br> ! <u>Developers:<br> ! </u>Diane Trout - <a href="http://www.caltech.edu/">Caltech</a>: <a href="http://woldlab.caltech.edu/">Wold Lab</a> - Pymerase Lead Developer and Original Designer<br> --- 42,47 ---- <a href="http://mged.sourceforge.net/">MAGE</a>.<br> <br> ! <u>Developers:</u><br> ! Diane Trout - <a href="http://www.caltech.edu/">Caltech</a>: <a href="http://woldlab.caltech.edu/">Wold Lab</a> - Pymerase Lead Developer and Original Designer<br> |
From: <ki...@us...> - 2003-03-08 01:53:28
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial/images In directory sc8-pr-cvs1:/tmp/cvs-serv31269 Added Files: linkdb-argouml.eps Log Message: Figure 1 --- NEW FILE: linkdb-argouml.eps --- %!PS-Adobe-3.0 EPSF-3.0 %%Creator: GIMP PostScript file plugin V 1.12 by Peter Kirchgessner %%Title: /home/king/proj/docs/pymerase/Docs/linkDB-tutorial/images/linkdb-argouml.eps %%CreationDate: Fri Mar 7 17:02:58 2003 %%DocumentData: Clean7Bit %%LanguageLevel: 2 %%Pages: 1 %%BoundingBox: 14 14 609 392 %%EndComments %%BeginProlog % Use own dictionary to avoid conflicts 10 dict begin %%EndProlog %%Page: 1 1 % Translate for offset 14.173228 14.173228 translate % Translate to begin of first scanline 0.000000 376.908661 translate 594.614173 -376.908661 scale [...2809 lines suppressed...] !rtXf!.dIf6CL7@!#:O'e,Vg%!!&%ge,Vg%!!&%geE#r`Ja],t"4)Dr!.Y~> !rtXf!.dIf6CL7@!#:O'e,Vg%!!&%ge,Vg%!!&%geE#r`Ja],t"4)Dr!.Y~> !s#cqQ@ZJq[[OW@Q:R%Fe4@$VQ:R%Fe4@$VQ:R%FeE#r`Ja],t"4)Dr!.Y~> !<>H;!.b-9!!IY?[fAbo!!IY?[fAbo!!R_@\&HS:J^9h3!e(+LJ,~> !<>H;!.b-9!!IY?[fAbo!!IY?[fAbo!!R_@\&HS:J^9h3!e(+LJ,~> !<BQZQ@Y?hQ5==#H_.]1[[(\mH_.]1[[(\mH_.^cbg(dcS'M.b!!%N~> JH16$PQ1bX?uZ#D!_Zp?qu?jm?uU@<JUX#9rr@Q~> JH16$PQ1bX?uZ#D!_Zp?qu?jm?uU@<JUX#9rr@Q~> !<AF:COp8fCDA0h?uRHYCMP7i?uRHYCMP7i?uU@<JUX#9rr@Q~> JH16$JH16$PlQ=~> JH16$JH16$PlQ=~> JH16$JH16$PlQ=~> !:k[@JH16$JH1u9J,~> !:k[@JH16$JH1u9J,~> !:k[@JH16$JH1u9J,~> %%EndData showpage %%Trailer end %%EOF |
From: <ki...@us...> - 2003-03-08 01:52:48
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial/images In directory sc8-pr-cvs1:/tmp/cvs-serv31160/images Log Message: Directory /cvsroot/pymerase/Docs/linkDB-tutorial/images added to the repository |
From: <ki...@us...> - 2003-03-08 01:52:31
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv31419 Modified Files: linkdb-tutorial.tex Log Message: Update, still needs lots of work. Index: linkdb-tutorial.tex =================================================================== RCS file: /cvsroot/pymerase/Docs/linkDB-tutorial/linkdb-tutorial.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** linkdb-tutorial.tex 7 Mar 2003 23:32:55 -0000 1.1 --- linkdb-tutorial.tex 8 Mar 2003 01:52:28 -0000 1.2 *************** *** 31,35 **** \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.1\\\today} \maketitle \thispagestyle{empty} --- 31,35 ---- \author{Brandon King \\ Copyright \copyright California Institute of Technology} ! \date{Version 0.1.2\\\today} \maketitle \thispagestyle{empty} *************** *** 43,47 **** %\chapter{\cb Introduction} ! \section{\cb The Goal} The goal of this tutorial is to use Pymerase to help us create a simple application to help us with the task of updating keywords on a --- 43,47 ---- %\chapter{\cb Introduction} ! \section{\cb The Goal}\label{the_goal} The goal of this tutorial is to use Pymerase to help us create a simple application to help us with the task of updating keywords on a *************** *** 124,127 **** --- 124,176 ---- please use the Patch tracker. Support Requests can be submitted to the tracker or the Pymerase-devel mailing list. + + \section{\cb Tutorial: LinkDB Schema} + \subsection{\cb Description}\label{linkdb-desc} + Now that we know what we want to do we have to design the + schema. If you haven't read section \ref{the_goal}, you may want to do + so now. There are two ways that currently exist in Pymerase. An XML + format defined by table.dtd. If you decide to use this format, you + need to use the parseGenexSchemaXML input module for Pymerase. The + other format, which we are going to use, is UML. In this case, + ArgoUML. We will be using the parseXMI input module for Pymerase. + + Before we actually make the schema in ArgoUML, let's describe it + first. We want a simple object called ''NameLinkPair'' which will + store a Keyword and the URL we want to associate with this keyword in + our html document. This would be good enough for our program, but if + we want one set of keyword/URL pairs for one html file, and another + set for a second html file, then this won't work very well. So, let's + add a group object with a name attribute. This will be used in our + command line program do define which group of keywords we want to use + on a given file. We will need to define an association between or + 'Group' object and our 'NameLinkPair' object. For the sake of + simplicity, we will limit 'NameLinkPair' objects to having 1 -- 1 + 'Group' objects, but the 'Group' objects can have 0 -- N + 'NameLinkPair' objects. Many-to-Many associations are possible, but + are a little more complicated, so I will leave them out of this + tutorial. + + \subsection{\cb ArgoUML} + We should now create an ArgoUML file based on the description in + \ref{linkdb-desc}. I assume you either already know how to use + ArgoUML, or you have read 'Pymerase Docs - ArgoUML'\footnote{Current + version of this is in the tutorial dictory in Pymerase CVS module + Docs}. If you haven't, you should do so now. + + When you finish creating the ArgoUML file it should look like Figure~1. + \begin{figure}[h] + \includegraphics[width=\textwidth]{images/linkdb-argouml.eps} + \caption{\cb LinkDB Schema in ArgoUML} + \end{figure} + Make sure you change the namespace property to 'LinkAPI' by clicking + on the 'Group' class and then on the name space textbox. Then should + be able to change the name. This is information that CreateDBAPI will + use as the package name of your generated DBAPI. + + Note that if you change the names of the classes or attributes in this + tutorial, you will have to do so throughout the whole tutorial. + + Create a director in you will work on this tutorial and save your + ArgoUML file as linkDB.zargo. \end{document} |
From: <ki...@us...> - 2003-03-07 23:47:43
|
Update of /cvsroot/pymerase/Docs In directory sc8-pr-cvs1:/tmp/cvs-serv12749 Modified Files: README Log Message: updated for linkDB-tutorial Index: README =================================================================== RCS file: /cvsroot/pymerase/Docs/README,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README 19 Feb 2003 21:46:55 -0000 1.2 --- README 7 Mar 2003 23:26:08 -0000 1.3 *************** *** 4,6 **** running_pymerase - Documentation about how to run pymerase ! tutorial - Tutorial on how to use pymerase \ No newline at end of file --- 4,11 ---- running_pymerase - Documentation about how to run pymerase ! ! linkDB-tutorial - Tutorial about how to use Pymerase using the linkdb ! example. ! ! tutorial - Tutorial on how to use pymerase ! OLD: Will be ArgoUML Tutorial in the near future. |
From: <ki...@us...> - 2003-03-07 23:33:01
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv15568 Added Files: linkdb-tutorial.tex Log Message: start of linkdb-tutorial --- NEW FILE: linkdb-tutorial.tex --- % Pymerase Docs - LinkDB Tutorial % Copyright (c) California Institute of Technology % % Authors: Brandon King % $Revision: 1.1 $ % Modified $Date: 2003/03/07 23:32:55 $ \documentclass{article} \usepackage{graphicx} \usepackage{color} %\usepackage{makeidx} \setlength{\parindent}{0in} \setlength{\parskip}{2mm} %colors %\definecolor{light-blue}{rgb}{0.42,0.54,1} \newcommand{\cb}{\color{blue}} %\makeindex %new commands \newcommand{\pymlink}{http://pymerase.sf.net} %document \begin{document} %title page \begin{titlepage} \title{\cb Pymerase Docs - LinkDB Tutorial} \author{Brandon King \\ Copyright \copyright California Institute of Technology} \date{Version 0.1.1\\\today} \maketitle \thispagestyle{empty} \end{titlepage} \tableofcontents \thispagestyle{empty} \newpage \setcounter{page}{1} %\chapter{\cb Introduction} \section{\cb The Goal} The goal of this tutorial is to use Pymerase to help us create a simple application to help us with the task of updating keywords on a webpage with links. Why might we want to create such a program? For example, you might be writting a webpage about all your favorate Python modules and what you've done with them. If you decide you want to create a link to http://www.python.org/ every time the word 'Python' appears, it would consome much of your time adding links at every occurance. Add ten more keywords like 'Python' that you would like to link to, and then updating your webpage with links could become a nightmare. It is true this python program would be fairly easy to create by creating your own file format and parser. Although, it's a good example of how Pymerase works and it's potential benifits. \section{\cb Tutorial Requirements} \subsection{\cb Software Requirements} \begin{itemize} \item Python 2.1\footnote{http://www.python.org} or greater \begin{itemize} \item Pymerase\footnote{\pymlink} \begin{itemize} \item Input: parseXMI \item Output: CreateDBAPI \item Output: CreateSQL \item Output: CreatePyTkWidgets \item Output: CreatePyTkDbWidgets \end{itemize} \item mxDateTime \footnote{http://www.egenix.com/files/python/mxDateTime.html} \item PyGresql\footnote{http://www.druid.net/pygresql/} \item maybe more %FIXME: Needs updating \end{itemize} \item Jython 2.1\footnote{http://www.jython.org/} or greater \begin{itemize} \item Java Xerces 2 Lib \footnote{http://xml.apache.org/xerces2-j/index.html} \end{itemize} \item PostgreSQL 7.2\footnote{http://www.postgresql.org/} or greater \item Java 1.3\footnote{http://java.sun.com/} or greater \item ArgoUML %FIXME: Need to set version dependancies \end{itemize} \subsection{\cb Previous Knowledge Requirements} \begin{itemize} \item ArgoUML\footnote{See \pymlink /docs/ for ArgoUML information} \item Python Language\footnote{Python Tutorial: http://www.python.org/doc/current/tut/tut.html} \end{itemize} \section{\cb Getting Help} \subsection{\cb Pymerase Web Site} One of the first places you should check out if you need help is the Pymerase web site at \pymlink. Most of the documentation you will need, if it's available, will be in the Docs section of the web site. \subsection{\cb Pymerase-devel Mailing List} Pymerase developers and users are using pymerase-devel at lists.sourceforge.net as a means of communication. If you need help or would like to track development status of Pymerase, subscribing to the mailing list is a good idea. You can do this by going to \pymlink~and clicking on the 'Mail Lists' button. Note that everyone is welcome to make posts related to Pymerase, not just developers. \subsection{\cb Trackers: Bugs, Feature Request, etc.} Currently, there are four trackers in use by the pymerase project on the development site\footnote{http://www.sf.net/projects/pymerase} at sourceforge.net. \begin{itemize} \item Bugs \item Support Requests \item Patches \item Feature Requests \end{itemize} Please submit Bugs and Feature Requests using these trackers. If you have a patch for pymerase, but do not want to become a developer, please use the Patch tracker. Support Requests can be submitted to the tracker or the Pymerase-devel mailing list. \end{document} %\printindex |
From: <ki...@us...> - 2003-03-07 23:32:27
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv15417 Added Files: Makefile Log Message: makefile for building pdf --- NEW FILE: Makefile --- linkdb-tutorial.pdf: linkdb-tutorial.tex latex linkdb-tutorial.tex latex linkdb-tutorial.tex dvipdf linkdb-tutorial.dvi gv linkdb-tutorial.pdf |
From: <ki...@us...> - 2003-03-07 23:23:20
|
Update of /cvsroot/pymerase/Docs/linkDB-tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv11602/linkDB-tutorial Log Message: Directory /cvsroot/pymerase/Docs/linkDB-tutorial added to the repository |
From: <ki...@us...> - 2003-03-07 20:27:04
|
Update of /cvsroot/pymerase/Docs/running_pymerase In directory sc8-pr-cvs1:/tmp/cvs-serv25850 Modified Files: Run_Pymerase.tex Log Message: updated coloring, and formatting. Index: Run_Pymerase.tex =================================================================== RCS file: /cvsroot/pymerase/Docs/running_pymerase/Run_Pymerase.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Run_Pymerase.tex 7 Mar 2003 02:52:56 -0000 1.1 --- Run_Pymerase.tex 7 Mar 2003 20:14:32 -0000 1.2 *************** *** 23,28 **** \title{\color{blue} Pymerase Docs - Running Pymerase} \author{Brandon King\\Copyright \copyright California Institute of Technology} ! \date{Version 0.1.1\\\today} \maketitle \end{titlepage} --- 23,29 ---- \title{\color{blue} Pymerase Docs - Running Pymerase} \author{Brandon King\\Copyright \copyright California Institute of Technology} ! \date{Version 0.1.2\\\today} \maketitle + \thispagestyle{empty} \end{titlepage} *************** *** 96,101 **** \\ ------------Driver Program Template-----------\\ ! \#!/usr/bin/env python import sys\\ import os --- 97,104 ---- \\ ------------Driver Program Template-----------\\ ! \color{red} ! \#!/usr/bin/env python + \color{black} import sys\\ import os *************** *** 104,123 **** \begin{tabbing} ! \#In\=put module to use (parseGenexSchemaXML.py would be\\ ! \# \> pymerase.input.parseGenexSchemaXML)\\ import pymerase.input.\em nameOfInputModule \\ \\ \#Output module to use (CreateDBAPI.py would\\ ! \# \> be pymerase.output.CreateDBAPI)\\ import pymerase.output.\em nameOfOutputModule \\ \\ if \_\_name\_\_ == '\_\_main\_\_':\\ ! \>\#Path to schema\\ \>schema = os.path.abspath('../path2schema/schema') \\ \\ ! \>\#Output Path\\ \>outputPath = os.path.abspath('./outputPath')\\ \\ ! \>\#Run pymerase\\ \>pymerase.run(\=schema,\\ \> \>pymerase.input.\em nameOfInputModule,\\ --- 107,135 ---- \begin{tabbing} ! \color{red} ! \#In\=\color{red}put module to use (parseGenexSchemaXML.py would be\\ ! \color{red} ! \# \> \color{red} pymerase.input.parseGenexSchemaXML)\\ ! \color{black} import pymerase.input.\em nameOfInputModule \\ \\ + \color{red} \#Output module to use (CreateDBAPI.py would\\ ! \color{red}\# \> \color{red} be pymerase.output.CreateDBAPI)\\ ! \color{black} import pymerase.output.\em nameOfOutputModule \\ \\ if \_\_name\_\_ == '\_\_main\_\_':\\ ! \> \color{red} \#Path to schema\\ ! \color{black} \>schema = os.path.abspath('../path2schema/schema') \\ \\ ! \> \color{red} \#Output Path\\ ! \color{black} \>outputPath = os.path.abspath('./outputPath')\\ \\ ! ! \> \color{red} \#Run pymerase\\ ! \color{black} \>pymerase.run(\=schema,\\ \> \>pymerase.input.\em nameOfInputModule,\\ |
From: <ki...@us...> - 2003-03-07 02:54:10
|
Update of /cvsroot/pymerase/Docs/running_pymerase In directory sc8-pr-cvs1:/tmp/cvs-serv8717 Added Files: Makefile Log Message: make file for building pdf --- NEW FILE: Makefile --- Run_Pymerase.pdf: Run_Pymerase.tex latex Run_Pymerase.tex dvipdf Run_Pymerase.dvi gv Run_Pymerase.pdf |
From: <ki...@us...> - 2003-03-07 02:53:46
|
Update of /cvsroot/pymerase/Docs/running_pymerase/images In directory sc8-pr-cvs1:/tmp/cvs-serv8615/images Added Files: PymeraseGUI.eps Log Message: graphic used by Run_Pymerase.tex --- NEW FILE: PymeraseGUI.eps --- %!PS-Adobe-3.0 EPSF-3.0 %%Creator: (ImageMagick) %%Title: (PymeraseGUI.eps) %%CreationDate: (Thu Mar 6 14:45:14 2003) %%BoundingBox: 0 0 648 375 %%DocumentData: Clean7Bit %%LanguageLevel: 1 %%Pages: 1 %%EndComments %%BeginDefaults %%EndDefaults %%BeginProlog % % Display a color image. The image is displayed in color on % Postscript viewers or printers that support color, otherwise % it is displayed as grayscale. % [...20489 lines suppressed...] 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000 end %%PageTrailer %%Trailer %%EOF |
From: <ki...@us...> - 2003-03-07 02:53:00
|
Update of /cvsroot/pymerase/Docs/running_pymerase In directory sc8-pr-cvs1:/tmp/cvs-serv8447 Added Files: Run_Pymerase.tex Log Message: Running Pymerase Docs redone in LaTeX =o) --- NEW FILE: Run_Pymerase.tex --- % Pymerase Docs - Running Pymerase % Copyright (c) California Institute of Technology % % Authors: Brandon King % $Revision: 1.1 $ % Modified $Date: 2003/03/07 02:52:56 $ \documentclass{article} \usepackage{graphicx} \usepackage{color} \setlength{\parindent}{0in} \setlength{\parskip}{2mm} %colors %\definecolor{light-blue}{rgb}{0.42,0.54,1} %document \begin{document} %title page \begin{titlepage} \title{\color{blue} Pymerase Docs - Running Pymerase} \author{Brandon King\\Copyright \copyright California Institute of Technology} \date{Version 0.1.1\\\today} \maketitle \end{titlepage} % SECTION: Method of Running Pymerase \section*{\color{blue}Methods of Running Pymerase} \begin{tabular}{ll} Command Line & pymerase/bin/pymerase\\ Pymerase GUI & pymerase/bin/pymerasegui.py\\ Driver Program & Small Python script for providing pymerase\\ & with information. \end{tabular} % SECTION: Pymerase: Command Line \section*{\color{blue}Pymerase: Command Line} Currently works with Python: Yes\\ Currently works with Jython: No \begin{tabbing} Lo\=ca\=ti\=on: pymerase/bin/pymerase\= \\ \\ \> Useage:\\ \\ \> \> pymerase -s [source] -i [inputModule] -d [destination] -o [outputModule]\\ \\ \> \> pymerase --source=[source] --inputModule=[inputModule] \\ \> \> \> --destination=[destination] --outputModule=[outputModule] \\ \\ \> \> Options:\\ \\ \> \> \> -s, --source=[foo] \> Location of input file or directory\\ \> \> \> -i, --inputModule=[foo] \> Name of PyMerase input translation module\\ \> \> \> -d, --destination=[foo] \> Location of output file or directory\\ \> \> \> -o, --outputModule=[foo] \> Name of PyMerase output module\\ \\ \> \> \> -g, --gui \> GUI Interface to Pymerase\\ \\ \> \> \> -t, --translators \> Displays more info about translators\\ \> \> \> -v, --version \> Displays version numbers\\ \> \> \> -h, --help \> Displays this help page\\ \\ \> Input Translators Available:\\ \> \> parseXMI\\ \> \> parseGenexSchemaXML\\ \\ \> Output Translators Available:\\ \> \> iPymerase\\ \> \> CreateHtmlForms\\ \> \> CreateTableXML\\ \> \> \ldots etc \ldots\\ \end{tabbing} % SECTION: Pymerase: GUI \section*{\color{blue}Pymerase: GUI} Currently works with Python: Yes\\ Currently works with Jython: No Location: pymerase/bin/pymerase --gui or pymerase/bin/pymerasegui.py As you can see from the figure below, it's pretty straight forward. You give the path to your source files, choose the input module of your choice (parseXMI currently only works in Jython), select your output modules, and give the paths to where you want the output to go. Note that iPymerase requires that ipython to be installed. Also, note that if you want to run ipython, all other options will be deselected. \includegraphics[width=\textwidth]{images/PymeraseGUI} % SECTION: Pymerase: Driver Program \section*{\color{blue}Pymerase: Driver Program} Currently works with Python: Yes\\ Currently works with Jython: Yes\\ \\ ------------Driver Program Template-----------\\ \#!/usr/bin/env python import sys\\ import os import pymerase \begin{tabbing} \#In\=put module to use (parseGenexSchemaXML.py would be\\ \# \> pymerase.input.parseGenexSchemaXML)\\ import pymerase.input.\em nameOfInputModule \\ \\ \#Output module to use (CreateDBAPI.py would\\ \# \> be pymerase.output.CreateDBAPI)\\ import pymerase.output.\em nameOfOutputModule \\ \\ if \_\_name\_\_ == '\_\_main\_\_':\\ \>\#Path to schema\\ \>schema = os.path.abspath('../path2schema/schema') \\ \\ \>\#Output Path\\ \>outputPath = os.path.abspath('./outputPath')\\ \\ \>\#Run pymerase\\ \>pymerase.run(\=schema,\\ \> \>pymerase.input.\em nameOfInputModule,\\ \> \>outputPath,\\ \> \>pymerase.output.\em nameofOutputModule)\\ \end{tabbing} --------End Driver Program Template--------- \end{document} |
From: <ki...@us...> - 2003-03-05 20:02:50
|
Update of /cvsroot/pymerase/htdocs/links In directory sc8-pr-cvs1:/tmp/cvs-serv22310 Modified Files: index.shtml Log Message: update Index: index.shtml =================================================================== RCS file: /cvsroot/pymerase/htdocs/links/index.shtml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** index.shtml 27 Feb 2003 20:35:46 -0000 1.6 --- index.shtml 5 Mar 2003 20:02:46 -0000 1.7 *************** *** 41,47 **** <ul> <li><a href="http://www.python.org/">Python</a> - Programming ! Languages</li> <li><a href="http://www.postgresql.org/">PostgreSQL</a> - Object-Relational DBMS</li> </ul> <br> --- 41,54 ---- <ul> <li><a href="http://www.python.org/">Python</a> - Programming ! Language</li> ! <li><a href="http://www.jython.org/">Jython</a> - Java version ! of Python</li> <li><a href="http://www.postgresql.org/">PostgreSQL</a> - Object-Relational DBMS</li> + <li>Python Modules</li> + <ul> + <li><a href="http://www.egenix.com/files/python/mxDateTime.html"> + mxDateTime</a> - Date Time module used by DBAPI</li> + </ul> </ul> <br> |
From: <ki...@us...> - 2003-03-05 02:30:35
|
Update of /cvsroot/pymerase/pymerase/examples/linkDB In directory sc8-pr-cvs1:/tmp/cvs-serv28918 Modified Files: linker.py Log Message: added documentation Index: linker.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/examples/linkDB/linker.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** linker.py 5 Mar 2003 02:01:03 -0000 1.3 --- linker.py 5 Mar 2003 02:30:32 -0000 1.4 *************** *** 46,64 **** Processes Command Line Arguments ! return (groupName, fileName) """ groupName = None fileName = None dsn = "localhost" database = "linkdb" - try: user = os.environ["USERNAME"] except: user = None - password = None try: opts, args = getopt.getopt(sys.argv[1:], "h:d:u:p:g:f:", ["host", --- 46,65 ---- Processes Command Line Arguments ! return (groupName, fileName, dsn, database, user, password) """ + + #Set default values for command line groupName = None fileName = None dsn = "localhost" database = "linkdb" try: user = os.environ["USERNAME"] except: user = None password = None try: + #define command line args opts, args = getopt.getopt(sys.argv[1:], "h:d:u:p:g:f:", ["host", *************** *** 75,79 **** printUseage() sys.exit(2) ! if len(sys.argv) <= 1: printUseage() --- 76,80 ---- printUseage() sys.exit(2) ! if len(sys.argv) <= 1: printUseage() *************** *** 81,103 **** --- 82,112 ---- for arg, val in opts: + + #Display Help if arg in ('--help', '--help'): printUseage() sys.exit() + #Set the group name to use when accessing the database if arg in ('-g', '--group'): groupName = val + #Set files name to use if arg in ('-f', '--file'): fileName = val + #host to connect to. Default = localhost if arg in ('-h', '--host'): dsn = val + #name of database. Default = linkdb if arg in ('-d', '--database'): database = val + #user name. Default = $USERNAME environment var if arg in ('-u', '--user'): user = val + #password. Default = None if arg in ('-p', '--password'): password = val *************** *** 120,123 **** --- 129,135 ---- def printUseage(): + """ + Prints the useage information + """ useage = """ Linker.py: *************** *** 147,150 **** --- 159,167 ---- def getFileData(fileName): + """ + opens file if exists + returns data + """ + if os.path.isfile(fileName): f = open(fileName, 'r') *************** *** 158,179 **** --- 175,213 ---- if __name__ == '__main__': + #retrive command line arguments if valid groupName, fileName, dsn, database, user, password = parseCommandLine() + #set fileName to absolute path fileName = os.path.abspath(fileName) + #Connects, or dies... Good luck! dbs = DBSession(dsn=dsn, database=database, user=user, password=password) + #get the group object with a given name + # this allows you to sort your links in groups groupList = dbs.getObjectsWhere(dbs.Group, 'name = \'%s\'' % (groupName)) + #If you entered a name that doesn't exist (CASE sensitive), + # the program quits if len(groupList) == 0: print "Group \"%s\" not found" % (groupName) sys.exit() + #If one group exists if len(groupList) == 1: + #get the group group = groupList.pop() + #get all the links in the group linkerList = group.getNameLinkPair() + #get the html file in string form for processing fileData = getFileData(fileName) + #save a backup copy of the file as fileName.bak + f = open(filename + '.bak', 'w') + f.write(fileData) + f.close() + + print "Processing Links:" for nameLink in linkerList: *************** *** 182,188 **** print "%s\t%s" % (name, url) - - fileData = re.sub(name+"(?!</a>)", "<a href=\"%s\">%s</a>" % (url,name), fileData) f = open(fileName, 'w') f.write(fileData) --- 216,226 ---- print "%s\t%s" % (name, url) + #replace keyword with link using regexp + fileData = re.sub(name+"(?!</a>)", "<a href=\"%s\">%s</a>" % \ + (url,name), + fileData) + + #save html file f = open(fileName, 'w') f.write(fileData) |
From: <ki...@us...> - 2003-03-05 02:01:07
|
Update of /cvsroot/pymerase/pymerase/examples/linkDB In directory sc8-pr-cvs1:/tmp/cvs-serv19662 Modified Files: linker.py Log Message: fixed white space formatting Index: linker.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/examples/linkDB/linker.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** linker.py 5 Mar 2003 01:43:17 -0000 1.2 --- linker.py 5 Mar 2003 02:01:03 -0000 1.3 *************** *** 176,182 **** --- 176,185 ---- fileData = getFileData(fileName) + print "Processing Links:" for nameLink in linkerList: name = nameLink.getName() url = nameLink.getUrl() + + print "%s\t%s" % (name, url) fileData = re.sub(name+"(?!</a>)", "<a href=\"%s\">%s</a>" % (url,name), fileData) |