List spam

2011-08-18 Thread Jason Staudenmayer
I really like this list as part of my learning tools but the amount of spam 
that I've been getting from it is CRAZY. Doesn't anything get scanned before it 
sent to the list?

Jason
 
 
 
..·><º>
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: List spam

2011-08-18 Thread Jason Staudenmayer

> On 18/08/2011 13:58, Jason Staudenmayer wrote:
> > I really like this list as part of my learning tools but the amount
> > of spam that I've been getting from it is CRAZY. Doesn't
> anything get
> > scanned before it sent to the list?
>
> I haven't seen any significant quantity of spam on the list for ages.
> (The occasional one does get through although I can't
> remember the last).
>
> I always access it as a mailing list, and I seem to recall that
> the newsgroup feed isn't filtered the same way as the mailing list is.

I've been getting more and more. Upon checking the header info the last
hop
is from the list server. Here's part of the header:

Received: from  (HELO mail.python.org) (82.94.164.166)
  by mail2.adventureaquarium.com with SMTP; 17 Aug 2011 23:53:17 -
Received: from albatross.python.org (localhost [127.0.0.1])
by mail.python.org (Postfix) with ESMTP id 3RfS705P3czN9Y
for ; Thu, 18 Aug 2011 01:53:16
+0200 (CEST)


I can deal with normal spam but this stuff I've gotten is all about
rape.

Jason


Adventure Aquarium is America's Most Touchable Aquarium!
Featuring the ALL NEW Stingray Beach Club
Where you can touch and hand feed the gentle stingrays


To buy and print your tickets at home visit  www.AdventureAquarium.com
  ..·><º>..·`·.><º>..·`·.><º>..·`·.><º>
..·`·.><º>..·`·.><º>..·`·.><º>
..·><º>..·`·.><º>

A Herschend Family Entertainment Company
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: List spam

2011-08-18 Thread Jason Staudenmayer

> On Aug 18, 2011, at 8:58 AM, Jason Staudenmayer wrote:
>
> > I really like this list as part of my learning tools but
> the amount of spam that I've been getting from it is CRAZY.
> Doesn't anything get scanned before it sent to the list?
>
> This has been discussed on the list a number of times before,
> so I'll refer you to the archives for details.
>
> Basically, the mailing list receives postings from Google
> Groups and vice versa. Most of the spam comes from Google
> Groups. If you add a mail filter that deletes anything with
> the "Organization" header set to "http://groups.google.com";,
> you won't see much spam anymore. In my experience, you'll
> also miss a number of legitimate postings.
>

Ahhh, that would explain all the google stuff in the headers. Thanks for
the heads-up
I'll look at changing my spamassassin scoring for those.

Jason


Adventure Aquarium is America's Most Touchable Aquarium!
Featuring the ALL NEW Stingray Beach Club
Where you can touch and hand feed the gentle stingrays


To buy and print your tickets at home visit  www.AdventureAquarium.com
  ..·><º>..·`·.><º>..·`·.><º>..·`·.><º>
..·`·.><º>..·`·.><º>..·`·.><º>
..·><º>..·`·.><º>

A Herschend Family Entertainment Company
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: List spam

2011-08-18 Thread Jason Staudenmayer
> On Aug 18, 8:39 am, "Jason Staudenmayer"
>  wrote:
> >
> > [snip irony]
> >
> > Adventure Aquarium is America's Most Touchable Aquarium!
> > Featuring the ALL NEW Stingray Beach Club
> > Where you can touch and hand feed the gentle stingrays
> >
> > To buy and print your tickets at home visit  
www.AdventureAquarium.com
>       ..·><º>..·`·.><º>..·`·.><º>..·`·.><º>
>                                     ..·`·.><º>..·`·.><º>..·`·.><º>
> ..·><º>..·`·.><º>
>
> A Herschend Family Entertainment Company

>Don't you find it a bit ironic that you are complaining about spam but
>yet you are spamming this group with your link to buy tickets to a
>stingray petting zoo (which is in fact an oxymoron?) under the guise
>of spam bashing?  Tip of the day: Create a website!

>PS: I do however find the recent "rape" spam atrocious!

I do know it is ironic that I forgot to stop the footer for the one reply.
It's not my choice to add it but I was able to find a way around that work 
policy for list emails. I'm a strong opponent of dropping any email with a 
stupid footer spam.

Jason
 
 
 
..·><º>


-- 
http://mail.python.org/mailman/listinfo/python-list


Code review request

2010-12-22 Thread Jason Staudenmayer
Hi All,
I'm a python newbie so please be kind. I've been reading book after book and 
have written a script or two but this is my first real "program". Just looking 
for any suggestions and pointers. I've done some work with bash scripts and php 
(not OOP) a while a go. I'm not a programmer but would like to possibly expand 
in to it (right now an IT guy). Am I on the right track so far?

The program should be documented enough to explain.

"""
Created on Tue Dec 21 13:39:41 2010
@author: jason

Usage: cmd_drug_testing.py [options]...
Will select a random employee from the local database (located in the current 
directory)
and display the name by default.

This program (Drug Testing) was written to help select employees for drug 
testing.
Program usage:

-h, --help   Displays this help info
-l, --list-emplysLists all employees in the database
-s, --select Select employee for testing
-r, --remove-emply   Delete employee from database, usage: -d 
employee_name or id
-e, --edit-emply Edit employee data in database, usage: -e 
employee_name or id 
   field_to_change new_value
-i, --insert-emply   Insert new employee in database: 
must fit this format -- "id:or '','lastname, 
firstname', 'email',0"
-f   Display database name and full path

This program was written by, Jason S. For the use of AA.

"""

# import our needed modules
import sqlite3 as sqlite
import sys, getopt

#set global vars
global cursor
global conn


def usage():
""" this just prints the usage in the doc string"""
print __doc__

def dbconnect(sql):
"""handel the connction to the sqlite db  """
dbConnection = sqlite.connect("drug-test.db")
#set the cursor
cursor = dbConnection.cursor()
try:
#execute the sql passed from the other funtions and return the results
result = cursor.execute(sql)
dbConnection.commit()
except sqlite.Error, e:
result = e.args[0]

return result

  
def listEmployees(sql):
#list all records in the database
listemp = dbconnect(sql)
for lst in listemp:
print "%s, %s, %s, %s" % (lst[0],lst[1],lst[2],lst[3])

def selectOneEmployee(sql):
#select a random record from the database
listemp = dbconnect(sql)
for empl in listemp:
print empl[0]

def removeOneEmployee(sqlchk,sqldel):
#delete one employee by ID number
chk = dbconnect(sqlchk)

if chk.fetchone() != None:
#check to make sure the ID is valid in the database
emply = dbconnect(sqlchk)
emply = emply.fetchall()
print "trying to remove employee %s" % (emply)
try:
dbconnect(sqldel)

except sqlite.Error, e:
result = e.args[0]
print result

else:
print "Employees ID is invalid, please check the ID number"

def insertEmployee(sql):
#insert a new employee into the database
print sql
try:
dbconnect(sql)

except sqlite.Error, e:
result = e.args[0]
print result

def main(argv):
"""The purpose of this program is to select an empployee from this database 
for random drug
testing. This program can also perform maintainance on same database."""
if argv == []:
sql = "SELECT name FROM employees ORDER BY RANDOM() LIMIT 1;"
print "The following employee has been selected\n"
selectOneEmployee(sql)

try:
#get the options passed by the user
opts, args = getopt.getopt(argv, 
"hlsr:e:i:d",["Help","list-emplys","select","remove-emply=","edit-emply=","insert-emply="])

except getopt.GetoptError:
usage()
sys.exit(2)

#check throught the options and respond accordingly
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit()
elif opt == '-d':
global _debug
_debug = 1
elif opt in ("-l", "--list-emplys"):
sql = "select * from employees"
listEmployees(sql)
elif opt in ("-s","--select"):
sql = "SELECT name FROM employees ORDER BY RANDOM() LIMIT 1;"
print "The following employee has been selected\n"
selectOneEmployee(sql)
elif opt in ("-r","--remove-emply"):
if arg == "":

sys.exit("You must provice the ID for the employee to remove")
sqlchk = "select * from employees where id = \"%s\"" % (arg)
sqldel = "delete from employees where id = \"%s\""  % (arg)
removeOneEmployee(sqlchk,sqldel)
elif opt in ("-i", "--insert-emply"):
sql = "insert into employees values(%s)" % (arg)
insertEmployee(sql)

if __name__ == "__main__":
main(sys.argv[1:])

## END ###

Than

RE: [SPAM] - Re: Code review request

2010-12-22 Thread Jason Staudenmayer

-Original Message-
From: python-list-bounces+jasons=adventureaquarium@python.org 
[mailto:python-list-bounces+jasons=adventureaquarium@python.org] On Behalf 
Of Stefan Sonnenberg-Carstens
Sent: Wednesday, December 22, 2010 3:24 PM
To: python-list@python.org
Subject: [SPAM] - Re: Code review request


Am 22.12.2010 19:34, schrieb Jason Staudenmayer: 
Hi All,


Hi Jason,

the program could be more dense.
You have several redundant code in there, too.

For example, all the *Employee functions basically just call dbconnect and let
it execute the sql there.
dbconnect in this respect is not a really straight name, as it does more than 
only
connect to a database.

You should avoid "!= None", better is "is not None".

The program flow is "awkward": if argv is empty (better say "if not argv"),
you show one employee, but then continue to parse opts.
I think the program would be more readable, if you would just handle
the different cases in an if-elseif-else-cascade.
The global statement is not needed,

But you can also try pylint, which will point some things out:


Report
78 statements analysed.


Thanks for the advice, I'll try to rework some of those issues. I did try the 
if-elif-else for the getopts but it didn't flow right for some reason (I'll try 
it again though).

Thanks again.

Jason
 
 
 
..·><º>

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Nested structures question

2011-01-12 Thread Jason Staudenmayer
Return False instead of break should work

else:
 print "You guessed it! The number was", the_number
 print "And it only took you", tries, "tries!\n"
 return False

Jason
 
 
 
..·><º>

> -Original Message-
> From: 
> python-list-bounces+jasons=adventureaquarium@python.org 
> [mailto:python-list-bounces+jasons=adventureaquarium@pytho
> n.org] On Behalf Of Physics Python
> Sent: Wednesday, January 12, 2011 2:53 PM
> To: python-list@python.org
> Subject: Re: Nested structures question
> 
> 
> Thanks,
> 
> Is this an indentation problem then?
> How do I update the sentinel within the secondary while loop. 
> I am trying to avoid using breaks by the way, as I can 
> program this example using breaks:
> 
> --- start---
> import random
> print "\tWelcome to 'Guess my number'!:"
> print "\nI'm thinking of a number between 1 and 100."
> print "Try to guess it in as few attempts as possible.\n"
> 
> the_number = random.randrange(1,101)
> 
> tries = 0
> 
> while True:
> guess = int(raw_input("Take a guess: "))
> tries += 1
> if guess > the_number:
> print "Lower..."
> elif guess < the_number:
> print "Higher..."
> else:
> print "You guessed it! The number was", the_number
> print "And it only took you", tries, "tries!\n"
> break
> if  tries == 7:
> print "Wow you suck! It should only take at most 7 tries!"
> break
> 
> raw_input ("\n\nPress the enter key to exit.")
> 
> --- end ---
> 
> But the book states that this can be done without needing to 
> use breaks.
> 
> Thanks!
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-- 
http://mail.python.org/mailman/listinfo/python-list