Surf Traffic Exchange
http://www.surftrafficexchange.com/?refid=5979 -- http://mail.python.org/mailman/listinfo/python-list
Big Cash
http://bigcash.zipnadazilch.com/index.php?referral=87081 -- http://mail.python.org/mailman/listinfo/python-list
Big Extra Cash
http://www.bigextracash.com/aft/3e8b26c3.html -- http://mail.python.org/mailman/listinfo/python-list
Best Online Currency Trading
http://www.etoro.com/B520_A26094_TClick.aspx -- http://mail.python.org/mailman/listinfo/python-list
Secure MultiRobot Management
Hi, I am currently doing my final year project "Secure mobile Robot Management" . I have done the theoretical aspects of it till now and now thinking of coding it . I would like to code in Python , but i am new to Python Network Programming . Some of features of my project are: 1. Each robot can send data to any other robot. 2. Each robot can receive data from any other robot. 3. Every Robot has atleast 1 other bot in its communication range. 4. maximum size of a data packet is limited to 35 bytes 5. each mobile robot maintains a table with routes 6. all the routes stored in the routing table include a ï¬eld named life-time. 7. Route Discovery Process initiated if there is no known route to other bot. 8. There is no server over here . 9. every bot should be able to process the data from other bots and both multicast/unicast need to be supported. Assume the environment is gridded mesh and bots exploring the area. They need to perform a set of tasks (assume finding some locations which are dangerous or smthing like that). My main concern is how to go about modifying the headers such that everything fits in 35bytes . I would like to know how to proceed and if any links or resources in this regard. How to modify the headers ? ie. all in 35 bytes . Thank You, Raja. -- http://mail.python.org/mailman/listinfo/python-list
WxPython
Hi, I am trying to develop an application which would mainly do the following 2 things . I would like to know how it can be achieved and also the libraries needed for it . i) active window tracking In this substate, the application records the title bar contents of the active/foreground window and how long, in seconds, that that window is active/in the foreground. If the same window remains in the foreground but the title bar changes (as happens with a web browser application) then a new record is created for each new window title. If a window title is recorded that was previously recorded (on the same date -- see "Data Structures" info in section 4.4), then the time should be added to the previously recorded active time for that window title. -- Example -- 1) User clicks "Start" -> app enters "recording" state. 2) User opens window titled "Window 1" -> app looks for any prior records for "Window 1" on current date. Finding none, it creates a new record. 3) User opens another window titled "Window 2" -> app records total time spent in "Window 1", then looks for any prior records for "Window 2" on current date. Finding none, it creates a new record. 4) User re-raises/re-activates previous window "Window 1" -> app records total time spent in "Window 2", then looks for any prior records for "Window 1" on current date. It finds the record created earlier, so no new record is created. 5) User clicks "Stop" (or "Exit") -> the app adds the time just spent in "Window 1" to the previously recorded time spent in "Window 1". App then returns to "ready" state. ii) idle In this substate, the app has detected that the computer's screensaver is active and no time will be recorded for the active/foreground window. This substate is entered automatically (from the active window tracking state) when the screensaver activates and exited automatically (returning to the active window tracking state) when the screensaver is deactivated. Note that this substate should only be entered if the app was in the active window tracking state when the screensaver activated. Awaiting Your Reply, Thank You , Raja. -- http://mail.python.org/mailman/listinfo/python-list
Overriding Sys.Settrace
Hi, I want to override the sys.settrace() call, create a way to trace the execution of a python program. Keep track of all objects created and destroyed. Keep track of the call pattern throughout the execution of the program and output a simplified "call graph" to standard out. Can anyone please tell me how to do this ? Thank You, -- http://mail.python.org/mailman/listinfo/python-list
Overriding Sys.Settrace
Hi, I want to override the sys.settrace() call, create a way to trace the execution of a python program. Keep track of all objects created and destroyed. Keep track of the call pattern throughout the execution of the program and output a simplified "call graph" to standard out. Can anyone please tell me how to do this ? Thank You, -- http://mail.python.org/mailman/listinfo/python-list
Override sys.settrace()
Hi, I want to override the sys.settrace() call, create a way to trace the execution of a python program. Keep track of all objects created and destroyed. Keep track of the call pattern throughout the execution of the program and output a simplified "call graph" to standard out. Please help me in this regard. Thank You, -- http://mail.python.org/mailman/listinfo/python-list
Overide settrace
Hi, I want to override the sys.settrace() call, create a way to trace the execution of a python program. Keep track of all objects created and destroyed. Keep track of the call pattern throughout the execution of the program and output a simplified "call graph" to standard out. Please help me in this regard. Thank You, -- http://mail.python.org/mailman/listinfo/python-list
override settrace
Hi, I want to override the sys.settrace() call, create a way to trace the execution of a python program. Keep track of all objects created and destroyed. Keep track of the call pattern throughout the execution of the program and output a simplified "call graph" to standard out. Please help me in this regard. Thank You, -- http://mail.python.org/mailman/listinfo/python-list
Re: override settrace
On Apr 25, 8:10 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Raja wrote: > > Hi, > > I want to override the sys.settrace() call, create a way to trace > > the execution of a python program. Keep track of all objects created > > and destroyed. Keep track of the call pattern throughout the execution > > of the program and output a simplified "call graph" to standard out. > > Please help me in this regard. > > > Thank You, > > How many times do you intend to post this question before waiting > patiently for an answer? > > regards > Steve > -- > Steve Holden +1 571 484 6266 +1 800 494 3119 > Holden Web LLC/Ltd http://www.holdenweb.com > Skype: holdenwebhttp://del.icio.us/steve.holden > Recent Ramblings http://holdenweb.blogspot.com Hi, I am sorry for the number of posts but there has been a problem while I submitted and the post didnt appear for almost an hour after my 1st post so I reposted it. -- http://mail.python.org/mailman/listinfo/python-list
Printing Using Python
Hi, Attached is the code . I want my program to save the current printer job properties and , when I reconnect the printer at a latter date , i need to print the saved job . Can you please help with my code ? How to print a document at a later stage and any errors in my code ? import win32ui import win32con myprinter_name = "" # get the name from your Printers folder printer_properties=[] def save(): pHandle = win32print.OpenPrinter(myprinter_name) properties = win32print.GetPrinter(pHandle, 2) pDevModeObj = properties["pDevMode"] printer_properties.append(pDevModeObj.FormName) printer_properties.append(pDevModeObj.PaperSize) printer_properties.append(pDevModeObj.Orientation) printer_properties.append(pDevModeObj.Color) printer_properties.append(pDevModeObj.Copies) printer_properties.append(pDevModeObj.DefaultSource) win32print.ClosePrinter(pHandle) def apply(): hprinter = win32print.OpenPrinter(myprinter_name) devmode = win32print.GetPrinter(hprinter, 2)["pDevMode"] devmode.FormName=printer_properties[0] devmode.PaperSize=printer_properties[1] devmode.Orientation=printer_properties[2] devmode.Color=printer_properties[3] devmode.Copies=printer_properties[4] devmode.DefaultSource=printer_properties[5] hdc = win32gui.CreateDC("WinPrint",myprinter_name,devmode) dc = win32ui.CreateDCFromHandle(hdc) dc.StartDoc('My Python Document') dc.StartPage() dc.EndPage() dc.EndDoc() del dc You help is greatly appreciated. Thank You, Raja. -- http://mail.python.org/mailman/listinfo/python-list
Multithreaded Python Mysql MAC Problems
Hi All, I wrote a multithreaded crawler program in Python 2.4 using Mysql 5.045 and MySqldb version as MySql-Python 1.2.2 on MAC OS 10.4.10 . The program strangely segfaults while it is running perfectly in Ubuntu and Windows as well. The gdb stack trace of program is below: LuLu:~/tempdownloads/crawl tspencer$ gdb python GNU gdb 6.1-20040303 (Apple version gdb-434) (Wed Nov 2 17:23:33 GMT 2005) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries .. done (gdb) run FinalCrawler.py Starting program: /Library/Frameworks/Python.framework/Versions/2.4/ bin/python FinalCrawler.py Reading symbols for shared libraries . done Program received signal SIGTRAP, Trace/breakpoint trap. 0x8fe01010 in __dyld__dyld_start () (gdb) bt #0 0x8fe01010 in __dyld__dyld_start () (gdb) info threads * 1 process 19802 local thread 0xf03 0x8fe01010 in __dyld__dyld_start () (gdb) continue Continuing. Reading symbols for shared libraries ... done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries .. done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries .. done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries ... done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done putting starting threads now putting putting putting putting putting putting putting putting putting 3 Now after Lock acquired 3 Now releasing lock Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x0090 [Switching to process 19802 thread 0x1703] _db_return_ (_line_=95, _sfunc_=0xb0283f3c, _sfile_=0xb0283f38, _slevel_=0xb0283f34) at dbug.c:828 828 state->framep = (char **) *state->framep; (gdb) The "putting" and number 3 are program's print statements. Can anyone please provide me with a insight into this problem and solution to it ? What might be the cause of this problem or how to go about further debugging it ? Thanks, Raja. -- http://mail.python.org/mailman/listinfo/python-list
Python GDB Wrapper
Hi, I am trying to develop a a GDB wrapper script in python which is able to extract a stack trace and all relevant data. Has anyone does this before ? Even some basic idea or code as to how to proceed would be great. Thanks, Raja. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python GDB Wrapper
Hi All, Thanks for replies. Daniel- I am looking at just a wrapper around GDB. I dont want to emulate the functionalities of GDB but instead use them in python scripting. Martin - Misc/gdbinit looks promising. Thanks a lot. Thanks, Raja. On Mar 7, 12:43 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Has anyone does this before ? Even some basic idea or code as to how > > to proceed would be great. > > Have you seen Misc/gdbinit? > > Regards, > Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Python GDB Wrapper
On Mar 7, 1:21 pm, Raja <[EMAIL PROTECTED]> wrote: > Hi All, > Thanks for replies. Daniel- I am looking at just a wrapper > around GDB. I dont want to emulate the functionalities of GDB but > instead use them in python scripting. > Martin - Misc/gdbinit looks promising. Thanks a lot. > > Thanks, > Raja. > > On Mar 7, 12:43 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > > > Has anyone does this before ? Even some basic idea or code as to how > > > to proceed would be great. > > > Have you seen Misc/gdbinit? > > > Regards, > > Martin Hi All, Marting- I looked at the Misc/gdbinit but what I want is a Python module which wraps around GDB and exposes its functionality, which has some methods in it like pystack to which if I give the arguments as program name and arguments displays the stack trace of that particular program . Thanks, Raja. -- http://mail.python.org/mailman/listinfo/python-list
EZ Recipe & Menu Costing
Customized Excel Workbook to Cost All Your Recipes & Menu Items http://food-drinks.page.tl/ -- http://mail.python.org/mailman/listinfo/python-list
Weinhaus Weiler
Historical half-timbered house with excellent cuisine in Oberwesel http://food-drinks.page.tl/ -- http://mail.python.org/mailman/listinfo/python-list
"Gain 700% More Muscle"
How To Gain Freaky Muscle Mass. As Seen On CNN. http://food-drinks.page.tl/ -- http://mail.python.org/mailman/listinfo/python-list
How I Lost My Belly Fat
I fought with excess belly fat for years until I found this 1 trick. http://food-drinks.page.tl/ -- http://mail.python.org/mailman/listinfo/python-list
Parmigiano Reggiano DOP
Eccelsa Qualità di Montagna per Rivenditori, Ristoranti e Privati. http://food-drinks.page.tl/ -- http://mail.python.org/mailman/listinfo/python-list
Traditional cuisine
with italian regional recipes with italian master chefs http://food-drinks.page.tl/ -- http://mail.python.org/mailman/listinfo/python-list
Superfruit strategy
Six Elements of Superfruit Success Buy new book of expert insights! http://food-drinks.page.tl/ -- http://mail.python.org/mailman/listinfo/python-list
Looking for a New Job?
Apply to Over 2,00,000 High Paying Jobs. Register Free Now! http://finance4u.synthasite.com/ -- http://mail.python.org/mailman/listinfo/python-list
Learn Web Design
Learn Web Design Online or in SF w/ Academy of Art. Free Info Packet. http://finance4u.synthasite.com/ -- http://mail.python.org/mailman/listinfo/python-list
Free Web Design Templates
Start B2B storefronts on Alibaba, Show products to all buyers - Free! http://finance4u.synthasite.com/ -- http://mail.python.org/mailman/listinfo/python-list
Monte Carlo Simulation
Download Latest Simulation Software Try Risk Solver Free for 15 Days. http://finance4u.synthasite.com/ -- http://mail.python.org/mailman/listinfo/python-list
Creating a Site?
Don't Forget Your Own Toolbar Keep The User a Step Away. Act Now http://finance4u.synthasite.com/ -- http://mail.python.org/mailman/listinfo/python-list
DreamTemplate.com
DreamTemplate.com World's Largest Web Template Store 3000+ CSS, Website, Flash, Logos http://finance4u.synthasite.com/ -- http://mail.python.org/mailman/listinfo/python-list
Fault Seal Analysis
Fault Seal Analysis Analyse Reservoir Fault, Lateral & Top Seal quickly and efficiently http://finance4u.synthasite.com/ -- http://mail.python.org/mailman/listinfo/python-list
Python cx_Oracle and Apache
Hi, I am trying to write a cgi program which would be executed on browser with Apache server installed. The program would make a connection to a database using cx_Oracle module and display results on page. The code is working fine on the command line but when executing it on the browser i get the famouse "Premature end of script headers" error. I went ahead and found the problem occuring exactly when the code is asking for a connection to the database. I am attaching the program for reference. Let me know if there is anything I need to make changes to apache or any other way to overcome this issue. #!/apollo/bin/env -e TestDatabaseTraceDashboard python import cgi import sys, os #import cgitb;cgitb.enable() #os.environ[ 'ORACLE_HOME' ] = '/opt/app/oracle/product/10.2.0.2/ client' #if os.environ.has_key( 'LD_LIBRARY_PATH' ): # ld_library_path = os.environ[ 'LD_LIBRARY_PATH' ] # os.environ[ 'LD_LIBRARY_PATH' ] = '%s/lib:%s' % ( os.environ[ 'ORACLE_HOME' ], ld_library_path ) #os.environ['BRAZIL_CONFIG']="--root=/apollo/env/ TestDatabaseTraceDashboard --user=oracle" try: import cx_Oracle import cx_Oracle_Amazon except ImportError, e: #sys.stdout.write( "Import error: %s" % ( e ) ) #sys.argv[0] = '/opt/app/oracle/admin/scripts/monitor-manager' def test_dbconnect(): connection=cx_Oracle.Connection('suvidhak_admin','database','dcrno1') cur=connection.cursor() cur.execute('select shipment_id from pending_customer_shipments where rownum < 10') return cur cursor = test_dbconnect() def generate_output(): print '' generate_output() Thanks, Raja. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python cx_Oracle and Apache
On Aug 25, 1:53 pm, Cousin Stanley <[EMAIL PROTECTED]> wrote: > > > > > def generate_output(): > > print '' > > > generate_output() > > Raja > > You might try adding a Content-type header followed by > a blank line to your generate_output() function > > def generate_output() : > print 'Content-type: text/html' > print > print rest of your html > > -- > Stanley C. Kitching > Human Being > Phoenix, Arizona Hi, Thanks for the help. I actually got the solution. The problem was apache's timeout is set to 1second. I just changed that value and it worked. Thanks, Raja. -- http://mail.python.org/mailman/listinfo/python-list
How to connect Python3.4.1 to Mysql 5.1 ?
Can any body tell how to access data from mysql using python. I am using python version 3.4.1 and Mysql version 5.1 -- https://mail.python.org/mailman/listinfo/python-list
Python Network Programming
Hi, I am currently doing my final year project "Secure mobile Robot Management" . I have done the theoretical aspects of it till now and now thinking of coding it .I would like to code in Python , but i am new to Python Network Programming . Some of features of my project are: 1. Each robot can send data to any other robot.2. Each robot can receive data from any other robot.3. Every Robot has atleast 1 other bot in its communication range. 4. maximum size of a data packet is limited to 35 bytes5. each mobile robot maintains a table with routes6. all the routes stored in the routing table include a ï¬eld named life-time.7. Route Discovery Process initiated if there is no known route to other bot. 8. There is no server over here . 9. every bot should be able to process the data from other bots and both multicast/unicast need to be supported.Assume the environment is gridded mesh and bots exploring the area. They need to perform a set of tasks (assume finding some locations which are dangerous or smthing like that). My main concern is how to go about modifying the headers such that everything fits in 35bytes . I would like to know how to proceed and if any links or resources in this regard. How to modify the headers ? ie. all in 35 bytes . Thank You, Raja. -- http://mail.python.org/mailman/listinfo/python-list
Re: very large dictionary
On Fri, 01 Aug 2008 14:47:17 +0100, Sion Arrowsmith wrote: > Simon Strobl <[EMAIL PROTECTED]> wrote: >>I tried to load a 6.8G large dictionary on a server that has 128G of >>memory. I got a memory error. I used Python 2.5.2. How can I load my >>data? > > Let's just eliminate one thing here: this server is running a 64-bit OS, > isn't it? Because if it's a 32-bit OS, the blunt answer is "You can't, > no matter how much physical memory you have" and you're going to have to > go down the database route (or some approach which stores the mapping on > disk and only loads items into memory on demand). I very highly doubt he has 128GB of main memory and is running a 32bit OS. -- http://mail.python.org/mailman/listinfo/python-list
Re: very large dictionary
On Fri, 01 Aug 2008 14:47:17 +0100, Sion Arrowsmith wrote: > Simon Strobl <[EMAIL PROTECTED]> wrote: >>I tried to load a 6.8G large dictionary on a server that has 128G of >>memory. I got a memory error. I used Python 2.5.2. How can I load my >>data? > Let's just eliminate one thing here: this server is running a 64-bit OS, > isn't it? Because if it's a 32-bit OS, [etc...] I very highly doubt he has 128GB of main memory and is running a 32bit OS. -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie having issues with threads
On Thu, 31 Jul 2008 14:09:12 -0700, James Calivar wrote: > I'm a newbie trying to write a script that uses threads. I'm right now > a little bit stuck in understanding why the code snippet I wrote doesn't > seem to be entering the function defined in the start_new_thread() call. > > If I run it as is (the threaded version), the output is: > > UA_1 configuring... > UA_1 halting.. > > But if I comment out the line w/ the thread and just call the function > directly, everything seems to work OK: > > UA_1 configuring... > UA_1 executing... > UA_1 halting... > > Can anyone tell me why the thread doesn't seem to invoke the function > "execute()"? I'm running Python 2.4.3. > > Here is my code: > > === > import thread > > class Test(object): > def __init__(self, instanceID): > self.instanceID = instanceID > def configure(self): > print self.instanceID + " configuring..." > def execute(self): > print self.instanceID + " executing..." > def halt(self): > print self.instanceID + " halting..." > > if __name__ == "__main__": > """usage: sipp_auto [options]""" > > ua1 = Test("UA_1") > > ua1.configure() > > #ua1.execute() > thread.start_new_thread(ua1.execute, ()) > > ua1.halt() > > === > Thanks, James I've run into this problem before. The main problem is that the thread started via start_new_thread exits when the program does(instead of finishing its work first). So what happens here is that sometimes it may have the time to execute, and sometimes it won't changing: thread.start_new_thread(ua1.execute, ()) ua1.halt() to: thread.start_new_thread(ua1.execute, ()) from time import sleep sleep(0.01) # this is barely even noticeable ua1.halt() fixes the problem in this case and the output is correct. However, you seem to have taken up using the threading module which is probably better anyway, just wanted to explain why this was happening. -- http://mail.python.org/mailman/listinfo/python-list
Re: raw_input on several lines
On Sat, 02 Aug 2008 21:58:09 +0200, TP wrote: > Hi everybody, > > When using raw_input(), the input of the user ends when he types Return > on his keyboard. > How can I change this behavior, so that another action is needed to stop > the input? For example, CTRL-G. It would allow the user to input several > lines. > > Thanks > > Julien Well I don't know about using CTRL-G. Now I'm pretty sure you can't change the behavior of raw_input() like this *but* what you do is the following: >>> from sys import stdin >>> user_input = stdin.readlines() this is a multiline test >>> user_input ['this\n', 'is\n', 'a multiline\n', 'test\n'] >>> The end of the input is marked by the "End of Transmission" or "End of File" character(which can be obtained via ctrl+D, at least on linux, I have no idea about win32) This would have the additional bonus of working with something being piped into it as an input -- http://mail.python.org/mailman/listinfo/python-list
Re: for x,y in word1, word2 ?
On Sun, 10 Aug 2008 21:40:55 -0700, Mensanator wrote: > On Aug 10, 11:18�pm, ssecorp <[EMAIL PROTECTED]> wrote: >> Is there a syntax for looping through 2 iterables at the same time? >> >> for x in y: >> � � for a in b: >> >> is not what I want. >> >> I want: >> for x in y and for a in b: > > Something like this? > a = ['a','b','c'] b = [1,2,3] zip(a,b) > [('a', 1), ('b', 2), ('c', 3)] zip and the nested loops don't do the same thing zipping then comparing would compare items that are at the same position the nested loops would compare each item to all the items in the other sequence, big difference AFAIK there's no better way to accomplish what the nested loops do with a simpler syntax -- http://mail.python.org/mailman/listinfo/python-list
Re: MSSQL LIKE and IN statements in ADO problem
Yes, Steve you have a very good point. Gregarcian, I am using the parameterized SQL to avoid such vulunerability. for example in your example use name = "%'WAITFOR DELAY '00:00:03'--%" and directly substitute it to the statement "select * from table_name where name like '%s' " % (name) The server will have to wait for three seconds and will return all the rows in the table, which is unwanted. I am trying to use parameterized statements to avoid these sort of SQL injection problems and have not managed yet to fix the LIKE and IN statement problems. /Raja Raman -- http://mail.python.org/mailman/listinfo/python-list
Re: MSSQL LIKE and IN statements in ADO problem
Yes, the statement you tried is a valid statement also >>> name = "%'WAITFOR DELAY '00:00:03'--%" >>> "SELECT * FROM tb_name WHERE firstname LIKE '%s'" % name is also valid. My question is how to use the LIKE statements using ADO.in python :-| -- http://mail.python.org/mailman/listinfo/python-list
Re: MSSQL LIKE and IN statements in ADO problem
Hi Gregarican, I am the original poster and yes this is a production code level problem. Do u have inputs for a solution? /Raja Raman -- http://mail.python.org/mailman/listinfo/python-list
Re: MSSQL LIKE and IN statements in ADO problem
Hello Steve, Roger and Pete, Nice to read your reply. Well, I can do an assert check for integers and then filter out hazardous SQL injection characters for varchars and do a direct substitution of the filtered values with the SQL statement. But by using ADO, input strings can be treated as what they are intended to be by adding values to the CreateParameter statement whe we do an Execute. This way I thought I need not care about what kind of input I get from the client, and I will be able to use them blindly to form a dynamic query. Thus producing a more general solution for SQL injection prone areas. Also, when it comes to filtering of hazardous characters, I think its better to allow only those characters one needs than to filter out SQL injection specific characters. But the problem is we have all kinds of special characters stored in our DB and filtering out characters will only result in wrong output. So, I have to rule out this case. With the DB API, yes I had a quick look at the code and the dynamic formation of the SQL statement does not seem to have support for IN statements. I am not sure about the LIKE statement though. Maybe, they do support it. So, I need to take a closer look at the adoapi.py file before concluding. To the concerned: >>> value = '%raj%' >>> "select * from table_name where firstname LIKE '%s' " % value works just fine, the result set contains all the first names that contains 'raj' How should we do this using createparameter in python? There should be a wasy toa chieve this in ADO using python. C# has a way to do this using ADO.Net. Please keep providing inputs, in the mean time I will also do some research on this problem and get back to you if I find a solution. Thanks! /Raja Raman -- http://mail.python.org/mailman/listinfo/python-list
Re: MSSQL LIKE and IN statements in ADO problem
This does not seem to work well Roger >>> value = '%raj%' >>> cmd.CommandText = "select * from table_name where firstname LIKE ?" result is 0 where I expected 4 /Raja Raman -- http://mail.python.org/mailman/listinfo/python-list
Re: tools to manipulate PDF document?
Yes, reportlad is a good tool for creating pdf and images -- http://mail.python.org/mailman/listinfo/python-list
Re: MSSQL LIKE and IN statements in ADO problem
Ok guys! The problem seems to be much easier to be solved than first thought. -->Shoot<-- Using the correct CreateParameter statement seems to do the trick. For example creating the parameter as cmd.CreateParameter(name,const.adVarChar, const.adParamInput, Size=16, Value=value[i]) # Name, Type, Direction, Size, Value works pretty good with the LIKE statement For the IN statement I have not yet found a good way. As of now in am looping through the values and creating various parameters Snippet: ## ##Global initialization ## typeMap= { types.IntType: const.adInteger, types.LongType: const.adBigInt, } query = "SELECT * FROM tb_name WHERE firstname IN %(in_params)" ## ##add parameters and construct the ? values for the in statements ##Note the code below is a pseudo type thing and can contain syntax errors ## in_parameters = [1,2,3,4,5] n_index = 0 in_params = '' for i in in_parameters: in_params += '?,' name = 'name_%s' % i p=cmd.CreateParameter(name, typeMap[type(i)], const.adParamInput, Size=16, Value=i) # Name, Type, Direction, Value cmd.Parameters.Append(p) query = query % {'in_params': in_params[:-1]} Any inputs to improve the IN statement logic? My dream is to use just one create parameter for the SQL list so that the query looks like query = "SELECT * FROM tb_name WHERE firstname IN ?" Nice and easy... :-) Thanks in advance! /Raja Raman -- http://mail.python.org/mailman/listinfo/python-list
Re: MSSQL LIKE and IN statements in ADO problem
Hi Gregarican, Thanks for sharing your code. One needs to add the % signs if one wants to do wildcard searches using LIKE in the SQL server. Do as Roger and Steve suggested '%raj%', now you can find the names containing the word raj anywhere in the column. just value = 'raj' is only going to fetch you fnames that == 'raj' Originally my problem was using the LIKE statement itself. But I guess you already know. /Raja Raman -- http://mail.python.org/mailman/listinfo/python-list
Overriding builtin getattr method
Hello guys, I have data stored in the database which has special characters like <, > etc. Case 1: Whenever I wanted to present the output to a browser I need to escape these special characters into the browser equivalent like < > etc.( for example by using the cgi module) Case 2: Whenever I wanted to present the output to some client other than a browser, I wanted to present the data as it is stored in the database. For doing this I thought of overriding the __builtin__.__getattr__ method. I am wondering if there is any other way of achieving this. I have loads of files that get the attribute values of objects stored in the database and I do not want to manually change the way of DB access in those files. I rather prefer a centralized way to achieve this. Good inputs are always appreciated. :-) Raja -- http://mail.python.org/mailman/listinfo/python-list
Re: Overriding builtin getattr method
Correction: I meant __builtin__.getattr method and not the other one I mentioned. :-) Thanks Raja Raja Raman Sundararajan skrev: > Hello guys, > I have data stored in the database which has special characters > like <, > etc. > Case 1: Whenever I wanted to present the output to a browser > I need to escape these special characters into the browser > equivalent like < > etc.( for example by using the cgi module) > Case 2: Whenever I wanted to present the output to some client other > than a browser, I wanted to present the data as it is stored in the > database. > > For doing this I thought of overriding the __builtin__.__getattr__ > method. > I am wondering if there is any other way of achieving this. I have > loads of files that get the attribute values of objects stored in the > database and I do not want to manually change the way of DB access in > those files. I rather prefer a centralized way to achieve this. > > Good inputs are always appreciated. > :-) > Raja -- http://mail.python.org/mailman/listinfo/python-list
Re: Overriding builtin getattr method
Hello Gabriel Genellina and Diez B. Roggisch, Thanks for sharing your opinions. I agree with Gabriel when he talks about the separation between the presentation and the DB level access and the drawbacks of introducing character manipulation. The problem that I am facing right now is that the presentation layer uses several different page rendering machines (about 12). Some of them use the escaping techniques that presents browser reserved characters to be "unrunnable" <,> we just some examples, so far so great. But the other presentation layer engines(about 9) used are basic (optimized for fast rendering) and do not use such filtering/encoding mechanisms. Since the amount of files that is used by the "basic" rendering machines are quite high, I am forced to fix the problem in a much lower level. I have found a work around for it...since the pages presented by the basic rendering machines knows about objects fetched from the DB and the type of request(which presentation engine to use) generated, I collect information about these in a struct. This struct also contains information about the level of encoding needed. I overrode __getattribute__ method (which is always called when one fetches an attribute of an object) in the base class and introduced encoding level in the class. The __getattribute__ then checks for the level of encoding needed depending on the infor from the struct and returns the encoded data to the presentation layer when needed. The business object or the functional layer is unaffected as the default value returned by the __getattribute__ is the unencoded data from the DB. Raja Diez B. Roggisch skrev: > >> I have data stored in the database which has special characters > >> like <, > etc. > >> Case 1: Whenever I wanted to present the output to a browser > >> I need to escape these special characters into the browser > >> equivalent like < > etc.( for example by using the cgi module) > >> Case 2: Whenever I wanted to present the output to some client other > >> than a browser, I wanted to present the data as it is stored in the > >> database. > >> > >> For doing this I thought of overriding the __builtin__.__getattr__ > >> method. > >> I am wondering if there is any other way of achieving this. I have > >> loads of files that get the attribute values of objects stored in the > >> database and I do not want to manually change the way of DB access in > >> those files. I rather prefer a centralized way to achieve this. > > The centralized approach to this is certainly not achieved by > overloading getattr alone - because even if it was possible to do so > (which it isn't), the implementation needed a way to know when to use > escaping or not. Which would be signaled by some means, e.g. a > thread-local variable or even a global (shudder). > > This signal gets set in the code that decides that it wants the data > escaped - or not. And thus the code looks like this: > > needs_escaping() > work_with_objects() > no_escaping_anymore() > > But that is fragile, think of work_with_objects() throwing an exception > and the no_escaping_anymore() isn't called again. > > So the better approach is to gather the data as it is, and when you > transform it to something that requires escaping, do it there. > > That means: the way to do it is to use one of the gazillion web > templating systems that already do this escaping for you. > > Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression Syntax Help
try this. maybe this is what you want? reg = re.compile('Name:.*\\n', re.IGNORECASE) -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression Syntax Help
Oh! yes you can use re for that. You just need to change the pattern a bit I did not understand where the "title" will be so I have ignored it, but I got something below which will be helpful for you >>> value = """name:asasasasas\nrequest: play\ntitle""" >>> reg = re.compile('Name:.*\\nrequest:.', re.IGNORECASE) >>> re.findall(reg, value) ['name:asasasasas\nrequest: play'] >>> value2 = """name:asasasasas\nrequest: next\ntitle""" >>> reg = re.compile('Name:.*\\nrequest:.', re.IGNORECASE) >>> re.findall(reg, value2) ['name:asasasasas\nrequest: next'] >>> -- http://mail.python.org/mailman/listinfo/python-list
Test indexers...how do they work?
Hello guys, I was investigating how one can use the "text indexers" in python and I stumbled across several ones. eg., pylucene I wanted to know how the algorithm of indexers look like. I have heard people talking about B-Trees. But this info. is simply know enough. I would like to know exactly each part of the indexing flow and the algorightm behind it work. Can someone here point me to the right material? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Multithreaded Python Mysql MAC Problems
Hi All, I wrote a multithreaded crawler program in Python 2.4 using Mysql 5.045 and MySqldb version as MySql-Python 1.2.2 on MAC OS 10.4.10 . The program strangely segfaults while it is running perfectly in Ubuntu and Windows as well. The gdb stack trace of program is below: LuLu:~/tempdownloads/crawl tspencer$ gdb python GNU gdb 6.1-20040303 (Apple version gdb-434) (Wed Nov 2 17:23:33 GMT 2005) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries .. done (gdb) run FinalCrawler.py Starting program: /Library/Frameworks/Python.framework/Versions/2.4/ bin/python FinalCrawler.py Reading symbols for shared libraries . done Program received signal SIGTRAP, Trace/breakpoint trap. 0x8fe01010 in __dyld__dyld_start () (gdb) bt #0 0x8fe01010 in __dyld__dyld_start () (gdb) info threads * 1 process 19802 local thread 0xf03 0x8fe01010 in __dyld__dyld_start () (gdb) continue Continuing. Reading symbols for shared libraries ... done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries .. done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries .. done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries ... done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done putting starting threads now putting putting putting putting putting putting putting putting putting 3 Now after Lock acquired 3 Now releasing lock Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x0090 [Switching to process 19802 thread 0x1703] _db_return_ (_line_=95, _sfunc_=0xb0283f3c, _sfile_=0xb0283f38, _slevel_=0xb0283f34) at dbug.c:828 828 state->framep = (char **) *state->framep; (gdb) The "putting" and number 3 are program's print statements. Can anyone please provide me with a insight into this problem and solution to it ? What might be the cause of this problem or how to go about further debugging it ? Thanks, Raja. -- http://mail.python.org/mailman/listinfo/python-list
MS word document generator
Hello guys, Is there any nice library to generate word documents using Python. As of today I am generating a HTML document and then open it with MS Word. But the problem is that I am not able to control the pages in the document and as a result of it the output looks terrible. I have been using reportlab's platypus to generate PDF documents. Its a nice application which allows controlling segments of the pages programatically. I was wondering if there was any library as reportlab to generate word documents. Thanks, /R -- http://mail.python.org/mailman/listinfo/python-list
Re: MS word document generator
Hi Tim, Thanks for your PyRTF suggestion. I am checking it out now :-) /R -- http://mail.python.org/mailman/listinfo/python-list
Re: MS word document generator
Hi guys, Thanks for your note Grant. I had a look at the pyRTF and it seems to be quite impressive :-) I actually works for my needs except the below, concerning cells in a table For cells in a table, pyRTF does not support 1. ALIGN_RIGHT 2. Cell background Do you guys have any idea of how to do this? Thanks /R -- http://mail.python.org/mailman/listinfo/python-list
pyRTF and cells
Hello, I have been playing around with pyRTF module for generating rtf documents. Its a very nice tool that fits my basic needs. However I have a problem controlling cells in a table. I am not able to 1. do an align right of contents inside a cell 2. set backgroundcolor of a cell 3. I wonder if there is a property to set cell height (?) Do you guys have any input on this? /R -- http://mail.python.org/mailman/listinfo/python-list
Re: pyRTF and cells
Yeah, thats a good approach. I have been fiddling around to implement that feature in elements.py and RTF specification from msdn However, I have not been successful thus far. To answer my first question: > 1. do an align right of contents inside a cell Its not possible by speficying alignment in the Cell instance However, if you really want this feature then create a Paragraph and then set alignment=2 for the ParagraphPropertySet object Snippet: p = Paragraph( ss.ParagraphStyles.Normal, ParagraphPS(alignment=2) ) p.append() c1 = Cell(p) -- http://mail.python.org/mailman/listinfo/python-list
Re: MS word document generator
Hi Michel, Well, Office 12 will have very many features. Thats true. But my document needs to work in all versions of Office. I hope that pyRtf generated file is fully rtf compatible. :-) But so far I think it is quite okay. To answer my first question: > 1. do an align right of contents inside a cell Its not possible by speficying alignment in the Cell instance However, if you really want this feature then create a Paragraph and then set alignment=2 for the ParagraphPropertySet object Snippet: p = Paragraph( ss.ParagraphStyles.Normal, ParagraphPS(alignment=2) ) p.append() c1 = Cell(p) I need to fiddle around with the RTF to see if I can implement coloring of Cells :-) /R -- http://mail.python.org/mailman/listinfo/python-list
Re: MS word document generator
Hi paron, I am using PyRTF as of now and it seems to fit my need quite well and it works like a charm :-). I have made a wrapper around it so that it will easier for me to switch the backend for generating the word/RTF docs later. May be, it will be openoffice :-) I appreciate your input. Thank you. :-) -- http://mail.python.org/mailman/listinfo/python-list