Re: Programming Language for Systems Administrator
I am confused to chose between C++,Python,Perl. Writing scripts in C++, you'll just die of brain burn. Python has very good shell integration and I heard it can do funky stuff with COM/OLE with a few lines of code where you'd need a few pages worth of impossible to understand COM code to do the same in C. Also basic shell tasks like spawning processes, piping from / to their output, regular expressions, parsing files, etc are a breeze. There are modules for INI files, csv files, etc. Perl should be about the same, but you have to like the scary syntax. -- http://mail.python.org/mailman/listinfo/python-list
Re: semicolons
sometimes i'll write if( key in myarray ) { ... in PHP and then realize I have to use array_key_exists and curse that the parameters are key then array, and bless scite auto-api-display for saving me each time... -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming Language for Systems Administrator
Thank You for your suggestionsI request you all to eloborate the Uses(In Practical) for systems administrator.Some of my questions regarding the same follows. What do you want to do ? 1)Can i build web applications in Python ? If so how. I am planning to build a web application for intranet use which deals with workflow of Internal office communication. Sure, you could use mod_python+apache2 or Zope, Skunkweb... there's a lot of options depending on what you need. I find it better than PHP because it'll raise exceptions when you do something funky. PHP's way of ignoring missing keys in arrays or silent type conversions is a double ended sword and can simplify code as well as giving hard to trace bugs. 2)Which is best opensource database to be used with Python ? I like postgresql a lot, and the psycopg adapter for python is great. 3)When i write a remote execution script in python is it required that python should be installed in remote system. Yes. 4)I heard about Perl/CGI and that CGI application done by python too.Is CGI still valid when PHP has taken over the WebApplication Development, Dominating. CGI will be slow as it spawns an interpreter for each request. See mod_python. -- http://mail.python.org/mailman/listinfo/python-list
Re: HELP ! Anybody knows where the stackless python website is ?
Great ! Thanks ! On Tue, 12 Apr 2005 16:15:42 +0200, cfbolz [EMAIL PROTECTED] wrote: Hi! Pierre-Frédéric Caillaud wrote: I've been trying desperately to access http://www.stackless.com but it's been down, for about a week now ! The stackless webpage is working again. Regards, Carl Friedrich Bolz -- http://mail.python.org/mailman/listinfo/python-list
Re: ATTN : Georges ( gry@ll.mit.edu)
My code so far: # -*- coding: iso-8859-1 -*- import sys import os from progadn import * ab1seq = raw_input(Entrez le répertoire où sont les fichiers à analyser: ) or None Ce serait mieux d'utiliser sys.argv pour spécifier le répertoire dans la ligne de commande du programme : import sys help(sys.argv) if ab1seq == None : print Erreur: Pas de répertoire! \n \ \nAu revoir \n sys.exit() je propose : import os, os.path, sys def usage(): print documentation... sys.exit(-1) args = sys.argv[1:] if not args: usage() files = [] for path in args: if os.path.isfile( path ): files.append( path ) elif os.path.isdir( path ): files.extend( [os.path.join( path, fname ) for fname in os.listdir( path )] ) else: print %s n'est ni un fichier ni un répertoire... % path usage() files = [ fname for fname in files if fname.endswith( .Seq ) ] 88 if not files: print Aucun fichier a traiter. usage() print Fichier à traiter : print , .join( files ) for path in files: print path checkDNA( open( path ).read() ) def checkDNA(seq): Retourne une liste des caractères non conformes à l'IUPAC. junk=[] for c in range (len(seq)): if seq[c] not in iupac: junk.append([seq[c],c]) #print junk print ATTN: Il y a le caractère %s en position %s % (seq[c],c) if junk == []: indinv=range(len(seq)) indinv.reverse() resultat= for i in indinv: resultat +=comp[seq[i]] return resultat Je réécris un peu votre fonction d'une manière plus python, à placer dans le programme avant son appel bien sûr ! def checkDNA( seq ): seq = seq.strip() if not seq: print Fichier vide. return resultat = [] for i,c in enumerate(seq): try: resultat.append( comp[c] ) except KeyError: print Catactère %s en position %d invalide % (c,i) resultat.reverse() return ''.join( resultat ) seq=checkDNA(seq) - Path: news3!feeder.news-service.com!news.glorb.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail From: gry@ll.mit.edu Newsgroups: comp.lang.python Subject: Re: problem with the logic of read files Date: 12 Apr 2005 10:47:17 -0700 Organization: http://groups.google.com Lines: 104 2 Message-ID: [EMAIL PROTECTED] References: [EMAIL PROTECTED] NNTP-Posting-Host: 129.55.200.20 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1113328069 32347 127.0.0.1 (12 Apr 2005 17:47:49 GMT) X-Complaints-To: [EMAIL PROTECTED] NNTP-Posting-Date: Tue, 12 Apr 2005 17:47:49 + (UTC) In-Reply-To: [EMAIL PROTECTED] User-Agent: G2/0.2 Complaints-To: [EMAIL PROTECTED] Injection-Info: o13g2000cwo.googlegroups.com; posting-host=129.55.200.20; posting-account=tzIXbQwAAACT3z3X4eITVLtksgiDRxhx Xref: news-x2.support.nl comp.lang.python:438583 [EMAIL PROTECTED] wrote: I am new to python and I am not in computer science. In fact I am a biologist and I ma trying to learn python. So if someone can help me, I will appreciate it. Thanks #!/cbi/prg/python/current/bin/python # -*- coding: iso-8859-1 -*- import sys import os from progadn import * ab1seq =3D raw_input(Entrez le r=E9pertoire o=F9 sont les fichiers =E0 analyser: ) or None if ab1seq =3D=3D None : print Erreur: Pas de r=E9pertoire! \n \nAu revoir \n sys.exit() listrep =3D os.listdir(ab1seq) #print listrep extseq=3D[] for f in listrep: ## Minor -- this is better said as: if f.endswith(.Seq): if f[-4:]=3D=3D.Seq: extseq.append(f) # print extseq for x in extseq: f =3D open(x, r) ## seq=3D... discards previous data and refers only to that just read. ## It would be simplest to process each file as it is read: @@ seq=3Df.read() @@ checkDNA(seq) seq=3Df.read() f.close() s=3Dseq def checkDNA(seq): Retourne une liste des caract=E8res non conformes =E0 l'IUPAC. junk=3D[] for c in range (len(seq)): if seq[c] not in iupac: junk.append([seq[c],c]) #print junk print ATTN: Il y a le caract=E8re %s en position %s % (seq[c],c) if junk =3D=3D []: indinv=3Drange(len(seq)) indinv.reverse() resultat=3D for i in indinv: resultat +=3Dcomp[seq[i]] return resultat seq=3DcheckDNA(seq) print seq # The program segment you posted did not define comp or iupac, # so it's a little hard to guess how it's supposed to work. It would # be helpful if you gave a concise description of what you want the # program to do, as well
Re: database in python ?
Bottomline - mysql has a lot of marketshare, is improving, and I'm sure that it'll eventually be a credible product. But right now it's has a wide range of inexcusable problems. I so totally agree with you. I find that mysql promotes bad coding practices by ignoring errors and substituting invalid data with factory defaults. If it complained when an obvious error occured (like inserting an invalid date or saying I can't fit this data in this column) it would be easy to find the bug ; instead it shows up months later in creepy ways when you realize part of your data was truncated, or otherwise screwed up in quite imaginative ways, and you have to fix the damn thing by hand, burning your eyes on phpmyadmin screens. Also most of the interesting features are in the Beta 5.0 ! I find it ironic that it's the biggest open source database while there are a lot of really free alternatives like firebird or postgres, which have all the good features Right Now, and which Just Work. There is also a lot of marketing hype and frankly I have no trust at all in a company which was making public statements like Who needs foreign keys ? just because their product didnot supports them, then when it supports them, changing their PR to match. More info at http://sql-info.de/mysql/gotchas.html buck -- http://mail.python.org/mailman/listinfo/python-list
Re: database in python ?
It's not a bug if you didn't RTFM. I did read it in much detail ! In fact I spent a lot of time trying to make understand how it could do a simple 4-table join to display also purchased products on an online store. The damn query took 0.5 seconds to execute no matter how I twisted it in and out ! Postgres did it in 0.5 milliseconds. I had to split the query in two in the application ! Speaking of the manual, the mysql manual is quite... well... i don't quite find the word, but it has many sentences which sound like PR stuff. Like, we don't do this like you or anyone would expect, but there is a reason ! Embrace our school of thought, stop worrying about integrity ! Peace, my friend, etc. And the non-working examples posted in the user comments are nice to look at, too. The organization of the manual is a mess, too, it's often quite difficult to find what I seek. The postgres manual is just wonderful. I know I'm feeding the flamewar, but I can't resist, once I came up on a post on the mysql website from a guy basically saying wow, the fulltext is so powerful, I can search this document set in only half a second ! and then the same day, on the postgres mailinglist, there was a message from a guy who was really upset because his full text search on something like 1000 times bigger would take more than one tenth a second, and that wan't really acceptable for him, and then several competent people responded and helped him make it work. That's also why I want to use postgres. -- http://mail.python.org/mailman/listinfo/python-list
HELP ! Anybody knows where the stackless python website is ?
Hello ! I've been trying desperately to access http://www.stackless.com but it's been down, for about a week now ! I desperatly need to download stackless python... Of course the stackless mailing list is on their server, so it's down, too. Does anybody has any info ? Does anybody have a tarball of a recent version of stackless that I may use (with the docs ?) Thanks ! Regards, P.F. Caillaud -- http://mail.python.org/mailman/listinfo/python-list
Re: database in python ?
MySQL is an excellent option is very well documented. It is also a defacto standard for OpenSource databases. MySQL sucks for anything but very very basic stuff as it supports no transactions, foreign keys, procedures, triggers, concurrency, etc. Postgresql is a lot better, free, and the psycopg adapter for Postgres is *very very* fast (a lot faster than the MySQL one) and it has a dictfetchall() method which is worth its weight in donuts ! -- http://mail.python.org/mailman/listinfo/python-list
Re: database in python ?
If you want Simple you can use the following piece of code. It won't work if you have a million records, but it's a nice intelligent flatfile storage with a select where + order by and limit emulator. # # class ListMgr( object ): def __init__( self, klass, filename ): self.filename = filename self.klass = klass self.load() def load( self ): try: self.contents = pickle.load( open( self.filename )) print Loaded %d items %s in %s % (len(self.contents), self.klass, type(self)) except IOError: print Creating new contents for, type(self) self.contents = {} self.save() if self.contents: self.insert_id = max( self.contents.keys() ) +1 else: self.insert_id = 1 def save( self ): pickle.dump( self.contents, open( self.filename+'.tmp', 'w' ) ) os.rename( self.filename+'.tmp', self.filename ) print Saved %d items %s in %s % (len(self.contents), self.klass, type(self)) def new( self, **params ): return self.klass( **params ) def insert( self, obj ): assert not hasattr( obj, 'id' ) or obj.id is None obj.id = self.insert_id self.insert_id += 1 self.contents[obj.id] = obj def update( self, obj ): assert obj.id is not None self.contents[obj.id] = obj def select( self, id ): return self.contents[ id ] def delete( self, id ): del self.contents[ id ] def count( self ): return len( self.contents ) # where is a lambda function, order_by is a cmp function, limit is a slice def select_multiple( self, where=None, order_by=None ): if where: c = filter( where, self.contents.itervalues() ) else: c = self.contents.values() if order_by: c.sort( order_by ) return c # # class ListEntry( object ): def __init__( self, **params ): self.__dict__ = dict.fromkeys( self.get_fields() ) self.__dict__.update( params ) def get_fields( self ): return () def display( self ): print '-'*40 if hasattr( self, 'id' ): print id :,self.id for k in self.get_fields(): print k, :,getattr(self,k) print # # class AddressBookEntry( ListEntry ): def get_fields( self ): return 'name', 'address', 'zipcode', 'city', 'country', 'phone' get_fields = classmethod( get_fields ) class AddressBook( ListMgr ): def __init__( self, fname ): super( AddressBook, self ).__init__( AddressBookEntry, fname ) -- http://mail.python.org/mailman/listinfo/python-list
Re: web authoring tools
Ideally, I would like an open source website + html design tool implemented in Python didn't you just say that ideally, you wanted a tool written in lisp or scheme? I honestly got a little tired of the tone of the answers I was getting from that crowd, about what an idiot I am. My query there is still You mean you are interested in a web application programming framework in the spirit of Seaside, or in a HTML/CSS editor in the spirit of Dreamweaver ? -- http://mail.python.org/mailman/listinfo/python-list
Re: The convenient database engine for a Distributed System
I've not used it personnally, but I heard good things about it : Firebird is a relational database offering many ANSI SQL-99 features that runs on Linux, Windows, and a variety of Unix platforms. Firebird offers excellent concurrency, high performance, and powerful language support for stored procedures and triggers. It has been used in production systems, under a variety of names since 1981. Firebird is a commercially independent project of C and C++ programmers, technical advisors and supporters developing and enhancing a multi-platform relational database management system based on the source code released by Inprise Corp (now known as Borland Software Corp) on 25 July, 2000 under the InterBase Public License v.1.0. Firebird is completely free of any registration, licensing or deployment fees. It may be deployed freely for use with any third-party software, whether commercial or not.. These seems to be an embedded version so that you can embed the library in your app and make everything nice and monolithic. -- http://mail.python.org/mailman/listinfo/python-list