Re: Best way to read, and analyze a log file?
Not exactly Wha I am looking, this seems to be a good project, but the way to parse the file I already have done that. I am looking in "desing pattern" advices, how to deal with the data. Must I use dbm? Must I make all the statistics and save in a dmf file? Any insights? Gregor Horvath wrote: > Hi, > > [EMAIL PROTECTED] schrieb: > > > I am reading a log file, and wondering what is the best way to read and > > analize this. > > Look at: > > http://pyparsing.wikispaces.com/ > > There is also an example for parsing an apache log. > > -- > Servus, Gregor > http://www.gregor-horvath.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Best way to read, and analyze a log file?
Thanks for all input.. I think I should put all data on a mysql base.. The company will need this for reports and statistics for a year. [EMAIL PROTECTED] wrote: > [EMAIL PROTECTED]: > > > 1- Read the data and put all variables in a list > > 2- Read the data and put all the variables in dictionary? > > the logs is in this format > > xx > > The separation is by byte size like > > xxx three bytes for code x , bytes for hour, etc.. > > I have two main objectives. > > Show all data to user. > > Analyze the data: like total sum, average,etc.. > > If you want to do all by yourself you can create a list of starting > positions, and you can add None to it, so you can use it to slice a > line with a loop. > You can also create a list of types, so you can cast the string parts > to their correct types, catching the exceptions. You can do it in a > second loop for clarity, or the first one to speed up a bit. > So you can just create a list of data for each input line, a dict may > be unnecessary because the number of fields seems fixed. > > Bye, > bearophile -- http://mail.python.org/mailman/listinfo/python-list
Simple HTML display of a select query
Hi all, How Can I do in the simplest way, display in html one table with the return of 3 collums? Like 1- consult mysql base 2- make the select query 3- show the values. I am a kind of lost in the frameworks, and modules. I think a lot of them with little documentation. Just a simple display in html for this, nothing more. No need this time for right coding, if I need to remake the program in the future its ok.. -- http://mail.python.org/mailman/listinfo/python-list
Simple python + html + from --> to python script
Hello All, I am trying to get information from a form and send it to a python script without success.. Here is my objective: User enters data in form --> form send variables to python script --> script runs and output result. the form code Entre com os dados Entre com os dados Vai magraum In my script.py What I should have to print something like Hello the data1 + data 2 = ? Maybe I am stumbling in something very simple, but I cannot find some working example, and I am totally confused... Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple python + html + from --> to python script
Man Very thanks... I really try to find some source of good and simple and nothing.. Many thanks you are a great help! Steve Holden wrote: > flit wrote: > > Hello All, > > > > I am trying to get information from a form and send it to a python > > script without success.. > > Here is my objective: > > > > User enters data in form --> form send variables to python script --> > > script runs and output result. > > > > the form code > > > > Entre com > > os dados > > > > Entre com os dados > > Vai magraum > > > > In my script.py > > > > What I should have to print > > something like > > > > Hello the data1 + data 2 = > > > > ? > > > > Maybe I am stumbling in something very simple, but I cannot find some > > working example, and I am totally confused... > > Thanks in advance > > > Untested, without error checking. Caveat emptor: > > import cgi > import cgitb; cgitb.enable() # optional error handling > > form = cgi.FieldStorage() > > d1 = form["data1"].value > d2 = form["data2"].value > > print """\ > Content-type: text/plain > > Hello: the data were: %s and %s""" % (d1, d2) > > regards > Steve > -- > Steve Holden +44 150 684 7255 +1 800 494 3119 > Holden Web LLC/Ltd http://www.holdenweb.com > Skype: holdenweb http://holdenweb.blogspot.com > Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple python + html + from --> to python script
Sorry but for a totally newbie the lib doccumentation doesnt help.. The target audience for the docs are for "grown ups" programmers.. I think I will do some tutorial, in baby steps... J. Clifford Dyer wrote: > A good starting place would be the documentation on python.org. > > In this case, the python library reference would have been helpful: > > http://docs.python.org/lib/lib.html > > Cheers, > Cliff > > > flit wrote: > > Man > > Very thanks... > > I really try to find some source of good and simple and nothing.. > > Many thanks you are a great help! > > > > Steve Holden wrote: > >> flit wrote: > >>> Hello All, > >>> > >>> I am trying to get information from a form and send it to a python > >>> script without success.. > >>> Here is my objective: > >>> > >>> User enters data in form --> form send variables to python script --> > >>> script runs and output result. > >>> > >>> the form code > >>> > >>> Entre com > >>> os dados > >>> > >>> Entre com os dados > >>> Vai magraum > >>> > >>> In my script.py > >>> > >>> What I should have to print > >>> something like > >>> > >>> Hello the data1 + data 2 = > >>> > >>> ? > >>> > >>> Maybe I am stumbling in something very simple, but I cannot find some > >>> working example, and I am totally confused... > >>> Thanks in advance > >>> > >> Untested, without error checking. Caveat emptor: > >> > >> import cgi > >> import cgitb; cgitb.enable() # optional error handling > >> > >> form = cgi.FieldStorage() > >> > >> d1 = form["data1"].value > >> d2 = form["data2"].value > >> > >> print """\ > >> Content-type: text/plain > >> > >> Hello: the data were: %s and %s""" % (d1, d2) > >> > >> regards > >> Steve > >> -- > >> Steve Holden +44 150 684 7255 +1 800 494 3119 > >> Holden Web LLC/Ltd http://www.holdenweb.com > >> Skype: holdenweb http://holdenweb.blogspot.com > >> Recent Ramblings http://del.icio.us/steve.holden > > -- http://mail.python.org/mailman/listinfo/python-list
Elliptic Curve Simple Example
Hello, I am trying the Python Cryptography Toolkit, but I didnt succeed, maybe I am not used to technical programming docs. WHat I succeed, using the the AES example to encrypt and decrypt. How Can I change it to use elliptic curves cryptography? Anyone has a working example, in python to use elliptic to encrypt and decrypt? Any help is good Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: Python development time is faster.
One thing I really like, is making "prototypes" on python. Just to test some algorithm or procedure. It is very fast and easy to debug. So after, I make it in c++ (but not too much often, I leave it in python today.) Chris Brat wrote: > I've seen a few posts, columns and articles which state that one of the > advantages of Python is that code can be developed x times faster than > languages such as <>. > > Does anyone have any comments on that statement from personal > experience? > How is this comparison measured? > > > Thanks > Chris -- http://mail.python.org/mailman/listinfo/python-list
looking for data on csv files
Hi! I am using the csv modules.. when I use the command: if nome in row[rowcsv]: print "\n" print row[rowcsv] + "\n > " + row[11] + "\n" print "" there is this case: 1- data on file PUItarr If the user try to find for puitarr or PUITARR it doesn´t find. I tried the string.upper and .lower , but there is a a way to look far all possible combinations? And yes, i am a newbie.. -- http://mail.python.org/mailman/listinfo/python-list
What make a great community
Hi all, I had one problem with csv files. And I put the message on 2 microsoft board and in this group. Results: No response from microsoft, and always 3 responses for posts on this lists. I just want to say thank you for all. And notice that this is a great community.. Flit The brazilian newbie -- http://mail.python.org/mailman/listinfo/python-list
working with ldap files
Hello All, I am struggling with some ldap files. I am using the csv module to work with this files (I exported the ldap to a csv file). I have this string on a field CN=pointhairedpeoplethatsux,OU=Groups,OU=Hatepeople,OU=HR,DC=fabrika,DC=com;CN=pointhairedboss,OU=Groups,OU=Hatepeople,OU=HR,DC=fabrika,DC=com this string is all the groups one user has membership. So what I am trying to do. read this string and extract only the CNs like pointhairdepeoplethatsux,pointhairedboss Or think in negative way remove the OU=** and DC= ** Any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Simple search and Display system, no need for db?
Hello All, I was discussing with a friend and we get in a hot debate. We have homepage that act like a name list. The user goes there: - Choose the building -- Department and the user receive an html table with all names . So the user gives two inputs and receive the names. Currently we are using this in mysql, This is the reason of the debate. If our list will never change and we are supposing that will be true for a long time, is it not too much use an mysql? Which kind of structure can we use in python? in web? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple search and Display system, no need for db?
On Jul 11, 3:06 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > If the data is not too large, simple text files would do. Maybe in CSV > format. Either with building and department as columns in the files or > coded into the file name or path. That seems to be a good idea, but I am afraid the web hosting does not have the csv modules.. (maybe if I do an split?) -- http://mail.python.org/mailman/listinfo/python-list
Technical Answer - Protecting code in python
Hello All, I have a hard question, every time I look for this answer its get out from the technical domain and goes on in the moral/social domain. First, I live in third world with bad gov., bad education, bad police and a lot of taxes and bills to pay, and yes I live in a democratic "state" (corrupt, but democratic). So please, don't try to convince me about the social / economical / open source / give to all / be open / all people are honest until prove contrary / dance with the rabbits... Remember I need to pay bills and security. Now the technical question: 1 - There is a way to make some program in python and protects it? I am not talking about ultra hard-core protection, just a simple one that will stop 90% script kiddies. 2 - If I put the code in web like a web service, how can I protect my code from being ripped? There is a way to avoid someone using my site and ripping the .py files? Thanks and sorry for the introduction -- http://mail.python.org/mailman/listinfo/python-list
Re: Technical Answer - Protecting code in python
First I wanna thanks the all people who gives good contribution to this thread, thank you all.. Now I have something more to say: OK, that kind of answer is what I was trying to avoid.. On Mar 21, 1:23 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 21 Mar 2007 06:36:16 -0700, flit wrote: > > 1 - There is a way to make some program in python and protects it? I > > am not talking about ultra hard-core protection, just a simple one > > that will stop 90% script kiddies. > > Protect it from what? Viruses? Terrorists? The corrupt government? Your > ex-wife cutting it up with scissors? People who want to copy it? People > who will look at your code and laugh at you for being a bad programmer? > > Until you tell us what you are trying to protect against, your question > is meaningless. In this time I supposed someone took too much coffee..But will ignore.. > > Is your program valuable? Is it worth money? Then the 90% of script > kiddies will just wait three days, and download the program off the > Internet after the real hackers have broken your protection. > > If it is NOT valuable, then why on earth do you think people will put up > with whatever "protection" you use? Why won't they just use another > program? It´s doesn´t matter if it is the next BIG HIT Ultra-fast-next-google thing or a programm to take control of my "pet-people-living-in- welfare-trying-to-be-political" It´s a technical question, If you can´t answer it ok, I will not suppose that you are it or that, it´s not a personal question or matter. > > 2 - If I put the code in web like a web service, how can I protect my > > code from being ripped? There is a way to avoid someone using my site > > and ripping the .py files? > > Don't make the .py files available on the web server. > Now we have a real contribution to the thread. Thank You > [penny drops] > > Hang on, you want us to believe that you're a serious computer programmer > with a seriously valuable program that's worth "protecting", and you don't > know that? I smell a troll. > > -- > Steven. Again, you don´t have to believe, suppose or think anything about me, are you capable to make any contribution? Technical one? Are you sooo good and "serious" programmer that you did not develop your personal skills, and thinks that winning an argument in internet is the best thing in the world? Thanks all, Flit (the-not-serious-programmer-that-wanna-to-be-a-big-capitalist-and-take- the-money-from all) -- http://mail.python.org/mailman/listinfo/python-list
Re: Technical Answer - Protecting code in python
I didn´t reply to the last D´Aprano reply just to avoid this kind of social war. And yes, I know that if I want 100% security I should not distribute my code. And there is a better way that is not doing any code to be more secure and bug-free (now I am using irony). And no, I am not supporter of software patents, RIAA and DRM. And Mr. Willems understood very well my problem and my condition. And others too in the beginning of the post. But look...after mr D´Aprano enters it starts this social warfare. So where is the troll? In fact I think the heroes series was based in this thread (Hiros read it and come back in time) Because there is some people who have special DNAs that give powers to see beyond their problems and environments, so they can read the post, understand and give technical details, understanding this is not comp.lang.python.social-activism-political-be-open-not-evil About trolls: No way I will do this question only to say to others: "Look python can´t do this like does.." or "Look now I will active the "pet-people-living-in-welfare-trying-to-be- political" in the list and they will join and sing songs about the revolution.." if you do a search in this group for this problem you will see more political whining than answers in this type of questions... Just look this post!! Seriously read one by one Begining ok.. 2 ok ,3 ok , 4 ok .. and bang..!!! Going back in the beginning I said : "So PLEASE, don't try to convince me about the social / economical / open source / give to all / be open / all people are honest until prove contrary / dance with the rabbits... " So who is failing to acknowledge the question? AND AGAIN someone will search for "protecting python code" and will see the same whining and political threads... I think the python community is great, and I love the python language, if you search for superflit in this group you will see that I love python and the community, I am a newbie, but I am not imposing my beliefs I am just saying that my reality is a little different and I need a answer for a particular problem. That is the reason because I always recommend people to travel out of their CONTINENT, and stay more than 5 months living in another culture. I can elaborate a more "intelectual" answer but sorry. I have to work at 6:00 am to pay my bills, and if I get unemployed there is no welfare, nothing , nada, zero. I believe in reincarnation, so next time I will aim better :) For me this thread is closed, and I think this is the most crazy thread in this list. Thank you all, for the technical answers, and sorry if I insult anyone directly or indirectly ( I am a political incorrect person) That´s all folks..finito -- http://mail.python.org/mailman/listinfo/python-list
way to extract only the message from pop3
Hello All, Using poplib in python I can extract only the headers using the .top, there is a way to extract only the message text without the headers? like remove the fields below: " Return-Path: X-Original-To: Received: from [ by (Postfix) with ESMTP id B32382613C for Tue, 3 Apr 2007 09:54:28 -0300 (BRT) Date: Tue, 03 Apr 2007 09:52:15 -0300 From: <@> To: Subject: test Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.24.02 [en] X-UIDL: !Dn!!HKT!!/k Status: RO " and only get this: this is a text message.. .. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: way to extract only the message from pop3
Yep you are right.. I made an filter to get the data in the message I want.. So it´s not the most beatiful code, but works. :) On Apr 4, 4:11 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > "flit" <[EMAIL PROTECTED]> wrote: > > >Using poplib in python I can extract only the headers using the .top, > >there is a way to extract only the message text without the headers? > > Only by using Python code. The other responses gave you good pointers > toward that path, but I thought I would point out the reason why. > > The POP3 protocol is surprisingly primitive. There are only two commands > to fetch a message: RETR, which fetches the headers and the entire message, > and TOP, which fetches the headers and the first N lines of the message. > The key point is that both commands fetch the headers. > -- > Tim Roberts, [EMAIL PROTECTED] > Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Advice from senior Members
Hello All, I am looking for some experience from the senior members. Now I am doing a simple desktop application, this application will have 3 main functions: 1- Read information about the desktop system; 2- Interact with the user; 3- Send information to a server. The first part, reading information about the desktop system, is already done. And now I am starting to make the gui for the user, that is when the question appear: "What is the best way to make it? divide in files? by classes or functions?" I have now one big file with all functions to get the desktop information. Should I make one file for the visual functions (wxpython)? another for the server? Is productive to divide in files? what is the best way? It seems like a naive question, maybe easy one, but I am willing to enjoy the experience from the most senior programmers here. Thanks -- http://mail.python.org/mailman/listinfo/python-list
check if the values are prensent in a list of values
Hello All, I will appreciate the help from the more skillfull pythonistas.. I have a small app that generates a sequence like 00341 01741 03254 This values I am putting in a list. So I have a list = [00341,01741,03254] after the programs find the sequence 03401 this sequence is "new" so it appends on the list. But I want to avoid that as the values are already on the first sequence of the list (00341). If I try to use a "in" statement it will give false. as 00341 is different from 00341 (but for my goal not..) How can I check against this list and avoid to put "different" sequences but same values? as 34100 --> dont append on the list 14300 ---> dont append on the list 05321 --> append to the list. Am I doing some conceptual error using lists? There is a better approach? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: check if the values are prensent in a list of values
On 9 set, 15:13, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Matt Nordhoff a écrit : > (snip) > > > I'm not judging whether this is a good solution or not, but that's a > > silly use of a dict. > > Yeps, but a somewhat common one in code predating the apparition of sets > as builtin type. Thanks for all contributions, sure I learn a lot with all samples. Very good thread and answers. Thank you all -- http://mail.python.org/mailman/listinfo/python-list