Re: Help me with this code PLEASE

2013-11-06 Thread Antoon Pardon
Op 05-11-13 22:26, Nick the Gr33k schreef:

> I know i'm close to solution, i can feel it but i have some issues.
> The code we arr discussing is the following:

No you are not. You are just doing random changes, without any
understanding. If you had followed my suggestion and actually
read the documentation of fetchone, you would have realised
this wouldn't have worked either.

Your resistance to reading the documentation is making you lose
more time than you hoped to win by just going ahead and trying
things blindly.

> [Tue Nov 05 23:21:52 2013] [error] [client 176.92.96.218]   File
> "/home/nikos/public_html/cgi-bin/metrites.py", line 274, in 
> [Tue Nov 05 23:21:52 2013] [error] [client 176.92.96.218] visit =
> visit.split()
> [Tue Nov 05 23:21:52 2013] [error] [client 176.92.96.218]
> AttributeError: 'NoneType' object has no attribute 'split'

This is essentially the same error you had before. You have an object
of NoneType where you expect something different. Changing your code
to use split instead of iteration won't change the fact that you have
an object of NoneType.

-- 
Antoon Pardon
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-06 Thread Nick the Gr33k

Στις 6/11/2013 9:38 πμ, ο/η Nick the Gr33k έγραψε:

Ah great!!!

I just examined my other MySQL database which just stored webpages and
their corresponding visits and voila.

Someone was able to pass values into my counters table:

look:

http://superhost.gr/?show=stats

thats why it didn't had 1 or 2 or 3 as 'counterID' but more values were
present.

Someone successfully manipulated this part of my code:

if cookieID != 'nikos' and ( os.path.exists( path + page ) or
os.path.exists( cgi_path + page ) ) and re.search(
r'(amazon|google|proxy|cloud|reverse|fetch|msn|who|spider|crawl|ping)',
host ) is None:

 try:
 # if first time for webpage; create new record( primary key is
automatic, hit is defaulted ), if page exists then update record
 cur.execute('''INSERT INTO counters (url) VALUES (%s) ON
DUPLICATE KEY UPDATE hits = hits + 1''', page )
..
..

I see no way of messing with the above statement other that tweak with
the 'page' variable but its not clear to me how.

You as more experience can you tell how the aboev code of database insertio



Here is more insight on how i initiate the 'page' variable:

==
# define how the .html or .python pages are called
path = '/home/nikos/public_html/'
cgi_path = '/home/nikos/public_html/cgi-bin/'

file = form.getfirst('file', 'forbidden')		# this value should come only 
from .htaccess and not as http://superhost.gr/~nikos/cgi-bin/metrites.py
page = form.getvalue('page')	# this value comes from 'index.html' or 
from within 'metrites.py'


if os.path.exists( file ) and not page:
# it is an html template
page = file.replace( path, '' )
==


Any ideas please on how the hacker manages to pass arbitrary values into 
the 'page' var since i explicitly define it and before database 
insertion i check for:


if cookieID != 'nikos' and ( os.path.exists( path + page ) or 
os.path.exists( cgi_path + page ) )


?!?!
--
https://mail.python.org/mailman/listinfo/python-list


Re: Help me with this code PLEASE

2013-11-06 Thread Mark Lawrence

On 06/11/2013 01:14, Nick the Gr33k wrote:


How, do i i proceed?


If at first you don't succeed, keep asking on comp.lang.python until 
someone gives me the completely bodged solution that I keep asking for 
even if it's complete nonsense.


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: How to add a current string into an already existing list

2013-11-06 Thread Mark Lawrence

On 06/11/2013 05:36, Dave Angel wrote:

On Tue, 5 Nov 2013 09:45:15 -0600, Tim Chase
 wrote:

You're assigning it to the bound function rather than calling the
function.  Use the "call" operator:



  data = infile.readlines()


Thanks for spoiling the lesson. Nicks needs to learn how to debug 4 line
programs without someone giving him the answer.



He needs to learn on short, consise programs before moving up to the 
medium size 4 liners.


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: Help me with this code PLEASE

2013-11-06 Thread Joel Goldstick
On Wed, Nov 6, 2013 at 3:49 AM, Mark Lawrence  wrote:
> On 06/11/2013 01:14, Nick the Gr33k wrote:
>>
>>
>> How, do i i proceed?
>
>
> If at first you don't succeed, keep asking on comp.lang.python until someone
> gives me the completely bodged solution that I keep asking for even if it's
> complete nonsense.
>
>
> --
> Python is the second best programming language in the world.
> But the best has yet to be invented.  Christian Tismer
>
> Mark Lawrence
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Nikos,

I believe we are passed the time again where your enquiries slip from
legitimate questions to trolling behavior.  As was pointed out you
aren't close to any solution.  You should go off taking the advice and
tutoring you have had here, do some reading (yes, actually learn and
understand something), perhaps start from scratch reading basics of
computer programming, databases, html, unicode, operating systems, web
servers, etc. and come back when you have a solid basis to ask a
question.

I take my profession seriously.  Its fun, but it takes a lot of
reading and studying and practice to be good at it.  The fact that you
even presume that you are doing what software designers, or engineers
or programmers do to ply the craft is disgusting.  Its not that you
don't know, its that you don't know and are an arrogant idiot to
assume that you do.

Your threads all end up being a very poor man's version of the movie
Ground Hog Day.  The fact that you don't recognize how rude and
insulting you are, and how little you bring to the discussion will
inevitably lead to more personal attacks since you aren't holding up
your end of the technical back and forth.

Your repeated behavior of starting new threads is just a boring
childish method to demand attention.  You have our attention.  I
believe that most of us if not all of us think you are the most
aggravating, incompetent, rude, needy, manipulating,  person we have
ever seen online ever.  Go away, and come back (months from now at
least) when you have some redeeming human qualities.

-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Anki add-on - Help needed

2013-11-06 Thread SH
Is anybody here able to help me finish off an Anki add-on? If you're not
familiar with it, Anki (http://ankisrs.net/) is an open source, cross
platform flashcard learning program, in PyQT. It's extensible, with add-
ons.

Thing is, I'm not a programmer, but I've managed to make my own add-on by
trying to figure out how other people's add-ons work. I've got something
that works, but it needs finishing off.

There is a lot I don't understand, but I've got this snippet which will
retrieve a value associated with the key 'dictKey' from a dictionary held
in a file. However, it will only do it if I open the Options dialog in
Anki (I'm guessing that's what DeckConf.loadConf is about). How can I get
that value for use in another function, without having to open the dialog?

[code]
from aqt.deckconf import DeckConf
from anki.hooks import wrap

def load_dictVal(self):
c = self.conf
x = c.get('dictKey')
print(x)

DeckConf.loadConf = wrap(DeckConf.loadConf, load_dictVal)
[/code]

The dictionary is in a file at (on Linux) ~/Anki/User 1/collection.anki2.
'User 1' may vary, and each user has their own collection.anki2 file. The
file's header says it's 'SQLite format 3'.


Secondly, separate from the above, I want to get a True/False value from
whether a deck is currently being studied? Maybe whether the review screen
is open, or something?

Any help would be greatly appreciated.

-- 

Stew

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


Re: install package from github repository

2013-11-06 Thread Amirouche Boubekki
2013/11/6 C. Ng 

> Ok, that seems to work... I modified from another package.
>

cool


> I don't understand how setup.py does it exactly, but got it done anyways.
>

as usual :-)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help me with this code PLEASE

2013-11-06 Thread Grant Edwards
On 2013-11-06, Denis McMahon  wrote:
> On Wed, 06 Nov 2013 00:35:56 +0200, Nick the Gr33k wrote:
>
>> Now i realizes i just cannot store lists into it's columns because it
>> does not support a collection datatype.
>
> All databases support storing of collections, but *NOT THE WAY YOU WANT 
> TO DO IT*
>
> You refuse to do it the proper way, so you have to bodge a solution  
> oh wait  I'm having a flashback here 

To quote the great Casey Stengel "it's deja vu all over again".

http://www.bostonbaseball.com/whitesox/baseball_extras/yogi.html

-- 
Grant Edwards   grant.b.edwardsYow! I feel like a wet
  at   parking meter on Darvon!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Anki add-on - Help needed

2013-11-06 Thread Joel Goldstick
On Wed, Nov 6, 2013 at 9:17 AM, SH  wrote:
> Is anybody here able to help me finish off an Anki add-on? If you're not
> familiar with it, Anki (http://ankisrs.net/) is an open source, cross
> platform flashcard learning program, in PyQT. It's extensible, with add-
> ons.
>
> Thing is, I'm not a programmer, but I've managed to make my own add-on by
> trying to figure out how other people's add-ons work. I've got something
> that works, but it needs finishing off.
>
> There is a lot I don't understand, but I've got this snippet which will
> retrieve a value associated with the key 'dictKey' from a dictionary held
> in a file. However, it will only do it if I open the Options dialog in
> Anki (I'm guessing that's what DeckConf.loadConf is about). How can I get
> that value for use in another function, without having to open the dialog?
>
> [code]
> from aqt.deckconf import DeckConf
> from anki.hooks import wrap
>
> def load_dictVal(self):
> c = self.conf
> x = c.get('dictKey')
> print(x)
>
> DeckConf.loadConf = wrap(DeckConf.loadConf, load_dictVal)
> [/code]
>
> The dictionary is in a file at (on Linux) ~/Anki/User 1/collection.anki2.
> 'User 1' may vary, and each user has their own collection.anki2 file. The
> file's header says it's 'SQLite format 3'.
>
>
> Secondly, separate from the above, I want to get a True/False value from
> whether a deck is currently being studied? Maybe whether the review screen
> is open, or something?
>
> Any help would be greatly appreciated.
>
> --
>
> Stew
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Best to you if someone here can help, but your question isn't really a
python question as much as one about how anki or pyqt work.  Have you
looked for mailing lists for pyqt or anki? you might have better luck
there.

-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


I need multiples images in one image whit PIL.

2013-11-06 Thread hpuerta
Hi, I need to join multiples images in one image, in client side i don't found 
the way to do, is possible in server side whit python django, any suggest?
-- 
https://mail.python.org/mailman/listinfo/python-list


Python PDB conditional breakpoint

2013-11-06 Thread Tom P
I can't get conditional breakpoints to work. I have a variable ID and I 
want to set a breakpoint which runs until ID==11005.


Here's what happens -


-> import sys
...
(Pdb) b 53, ID==11005
Breakpoint 1 at /home/tom/Desktop/BEST Tmax/MYSTUFF/sqlanalyze3.py:53
(Pdb) b
Num Type Disp Enb   Where
1   breakpoint   keep yes   at /home/tom/Desktop/BEST 
Tmax/MYSTUFF/sqlanalyze3.py:53

stop only if ID==11005

(Pdb) l
 50 for ID in distinct_IDs:
 51  	cursr.execute("select Date, Temperature from data where 
StationID = ? and Date > 1963", ID)

 52 datarecords = cursr.fetchall() # [(date, temp),..]
 53 B->  ll =  len(datarecords)
 54 if ll > 150:   # and len(results) < 100 :

(Pdb) c
...
std_error too large  -132.433 61.967 10912
std_error too large  -133.36274 62.2165 10925
std_error too large  -137.37 62.82 10946
std_error too large  -138.217 64.45 10990
std_error too large  -138.32 65.35 11005
std_error too large  -138.32 65.35 11005
std_error too large  -138.32 65.35 11005
std_error too large  -138.32 65.35 11005
std_error too large  -134.86625 67.415 11036
std_error too large  -135.0 68.22908 11053
...

 - in other words it doesn't stop even though the value ID == 11005 
shows up. Am I specifying the condition incorrectly?


This is Python 2.7.4, Linux 64 bit.

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


To whoever hacked into my Database

2013-11-06 Thread Νίκος Γκρ33κ

Okey let the hacker try again to mess with my database!!!

He is done it twice, lets see if he will make it again!

I'am waiting!
--
https://mail.python.org/mailman/listinfo/python-list


Re: I need multiples images in one image whit PIL.

2013-11-06 Thread Roy Smith
In article <6a9d8528-5f64-4d0f-b759-1d73078eb...@googlegroups.com>,
 hpue...@apptitud.com.co wrote:

> Hi, I need to join multiples images in one image, in client side i don't 
> found the way to do, is possible in server side whit python django, any 
> suggest?

There are several¦ Python image manipulation packages which could do 
this.  PIL is sort of the classic, but perhaps not the most convenient 
to use:

http://www.pythonware.com/products/pil/

There are several Python bindings for ImageMagic.  I've not used it 
myself, but heard good things about it:

http://www.imagemagick.org/script/api.php#python

http://pythonvision.org/ looks like they have some good pointers to 
other possibilities.  Googling for "python image manipulation" should 
find you some more.
-- 
https://mail.python.org/mailman/listinfo/python-list


[solved]Re: Python PDB conditional breakpoint

2013-11-06 Thread Tom P

On 06.11.2013 16:14, Tom P wrote:

ok I figured it. ID is a tuple, not a simple variable.
 The correct test is ID[0]==11005



I can't get conditional breakpoints to work. I have a variable ID and I
want to set a breakpoint which runs until ID==11005.

Here's what happens -



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


Re: To whoever hacked into my Database

2013-11-06 Thread Joel Goldstick
On Wed, Nov 6, 2013 at 10:25 AM, Νίκος Γκρ33κ  wrote:
> Okey let the hacker try again to mess with my database!!!
>
> He is done it twice, lets see if he will make it again!
>
> I'am waiting!
> --
> https://mail.python.org/mailman/listinfo/python-list


Nothing like a good challenge.  I personally would rather watch a bad
infomercial, but for all of you bloodthirsty shut ins with nothing to
do... here's your moment!


-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Alister
On Wed, 06 Nov 2013 17:25:04 +0200, Νίκος Γκρ33κ wrote:

> Okey let the hacker try again to mess with my database!!!
> 
> He is done it twice, lets see if he will make it again!
> 
> I'am waiting!


I don't think any cracker (hacker is something different) would need to.
you are doing a more than adequate job of screwing things up yourself.

you say you have taken the advise of this group on one subject
follow the rest of it.

DON'T do your development work on your main system.

keep your development computer disconnected from the internet.

do not move the development code to the production server until it has 
been thoroughly tested.

and above all else read the links you have been given & learn the basics 
of database handling before you even start.

(sorry every one I tried not to reply to Nicos but finally lost it)

-- 
"I don't know, " said the voice on the PA, "apathetic 
bloody planet, I've no sympathy at all. "
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Auto-authorization for Google Drive using Python in Mac OS X

2013-11-06 Thread Peter Pearson
On Mon, 4 Nov 2013 11:46:54 -0800 (PST), Pratik Mehta wrote:

> I have written Python code for Google Drive which uploads the image
> files to my drive app. I have three queries. Here is my code:
[snip]
>
> My Queries:
> 1. This program will upload all the images to my given client_id and
> client_secret.  How do I make users to use my app and upload their
> images to their own Google Drive?
> 2. I want to automate this task. Whenever I run this application in
> terminal, it always asks me for the authorization code, which I don't
> want. Can this be bypassed?
> 3. I read about refresh_tokens, but couldn't find how can I implement
> this in my app for automating the authorization.  So, is
> refresh_tokens used for that? If yes, then how do I implement it in my
> program?  If not, then how can I make sure that as soon as my
> application is loaded, that particular file gets uploaded on google
> drive directly, without any authorization, or with any
> auto-authorization way, so that user interaction is chucked
> completely.

I'm sorry to see that you haven't gotten a response. I can't help,
because I can't understand the questions, perhaps because they
require intimate knowledge of Google Drive or of a library that
you're using to access Google Drive.  This is ordinarily an
amazingly helpful group; perhaps you could find a more specific
question that could be illustrated with shorter code.


-- 
To email me, substitute nowhere->spamcop, invalid->net.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Steve Simmons


On 06/11/2013 16:40, Alister wrote:

On Wed, 06 Nov 2013 17:25:04 +0200, Νίκος Γκρ33κ wrote:


Okey let the hacker try again to mess with my database!!!

He is done it twice, lets see if he will make it again!

I'am waiting!


(sorry every one I tried not to reply to Nicos but finally lost it)


 :-)  Sometimes it just has to be done.

Oh, and BTW you missed out "don't expose too much of your production 
code to a group of techs that you have irritated, insulted and abused."


SteveS
--
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Mark Lawrence

On 06/11/2013 15:25, Νίκος Γκρ33κ wrote:

Okey let the hacker try again to mess with my database!!!

He is done it twice, lets see if he will make it again!

I'am waiting!


Terribly sorry old chap.  We had our first team meeting this morning. 
They were very enthusiastic, really wanted to get on with your job.  I 
told them not to touch anything, but you know what youngsters and their 
little fingers are like.


Oh, and while I'm at it, it wasn't me.

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: Python on a MacBook Pro (not my machine)

2013-11-06 Thread John Ladasky
I just wanted to say thank you to everyone who posted here with recommendations 
for programming-friendly text editors.  I will follow up on this after I have 
resolved a more fundamental issue with my new student -- his Python 3.3.2 
interpreter segfaults and crashes on the second command!  I'll start a new 
thread to deal with that problem.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to load test a web app?

2013-11-06 Thread Mike Williams
On Fri, Nov 1, 2013 at 11:03 AM, Albert-Jan Roskam  wrote:
 I would like to test the reliability and stability of at least one of them

I am curious whether the program will crash under certain circumstances
> (e.g. multiple users checking code at *exactly* the same moment). What
> approach could I follow here? Though this does not *necessarily* have to
> involve Python, I would prefer this. The way I see it, it would carry out
> certain common usage patterns many times to simulate many users. I thought
> about using mechanize/subprocess, the multimechanize package, or the twill
> package.
>
>
>
Have a look at selenium and sauce labs:

http://www.seleniumhq.org/
https://saucelabs.com/

Mike
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-06 Thread Denis McMahon
On Wed, 06 Nov 2013 09:30:03 +0200, Nick the Gr33k wrote:

> I have decided to take your advice.

No you haven't. You only think you have, but really you either haven't 
understood the advice at all.

> My implementation is like the following.
> I do not use an extra table of downlaods that i asoociate with table
> visitors with a foreing key but decided to add an additional 'download'
> column into the existant visitors table:

No no no no no no no no no no nononononono no!

That's *NOT* the right way to do it.

And this is where I finally and terminally give up trying to help you. 
I've had enough. You refuse to learn the right way to do it. You won't 
listen to the opinions and suggestions of people with a great deal more 
experience than you have in such matters. It's not going to work properly 
in the end. I refuse to be associated with it any further.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-06 Thread rusi
On Wednesday, November 6, 2013 11:29:11 PM UTC+5:30, Denis McMahon wrote:
> On Wed, 06 Nov 2013 09:30:03 +0200, Nick the Gr33k wrote:

> > I have decided to take your advice.

> No you haven't. You only think you have, but really you either haven't… 

No, you think that he thinks that he has.
Of course more correctly, I think that you think that he thinks that he has 
whereas in fact (I think) that he doesn't think that he has.

[Sorry couldn't resist!]


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


Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-06 Thread Mark Lawrence

On 06/11/2013 17:59, Denis McMahon wrote:

On Wed, 06 Nov 2013 09:30:03 +0200, Nick the Gr33k wrote:


I have decided to take your advice.


No you haven't. You only think you have, but really you either haven't
understood the advice at all.


My implementation is like the following.
I do not use an extra table of downlaods that i asoociate with table
visitors with a foreing key but decided to add an additional 'download'
column into the existant visitors table:


No no no no no no no no no no nononononono no!

That's *NOT* the right way to do it.

And this is where I finally and terminally give up trying to help you.
I've had enough. You refuse to learn the right way to do it. You won't
listen to the opinions and suggestions of people with a great deal more
experience than you have in such matters. It's not going to work properly
in the end. I refuse to be associated with it any further.



Queen "Another one bites the dust".

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Py 3.3.2, MacBookPro, segmentation fault, GCC issue?

2013-11-06 Thread John Ladasky
I am trying to help a student of mine install Python 3 on his MacBook Pro.  The 
installation succeeds.  However, upon opening the Python interpreter, he can 
only execute one Python command successfully.  On the second command, the 
interpreter crashes, giving the error "Segmentation fault: 11".

I have installed Python 3 on Linux and on Windows before, but I have no prior 
experience with Macs.  I know that OSX is Unix-like, but I'm sure that there 
are significant differences between the Linux that I normally use and OSX.

My student's computer is configured as follows: MacBook Pro, 2.5 GHz Intel Core 
i5, 4 GB RAM 1600 MHz DDR3, OS X 10.9.  We installed the Python 3.3.2 Mac OS X 
64-bit/32-bit x86-64/i386 Installer (for Mac OS X 10.6 and later) from 
http://python.org/download.

The Python interpreter reported the following when it was opened:

Python 3.3.2 : d047928ae3f6, May 13 2013, 13:52:24
GCC 4.2.1 (Apple Inc. build 5666) (dot3) on darwin

I do not know exactly how the Mac installer works.  It seemed to operate 
quickly.  It reported very little about what work it was actually doing.  Does 
it install pre-compiled binaries, or does it actually build Python locally from 
source code?  GCC 4.2.1 strikes me as OLD.  According to 
http://gcc.gnu.org/releases.html, it was released in 2007!  I would guess that 
the segfault is occurring because the Python interpreter was compiled using an 
outdated GCC.  

First question: did this outdated compiler execute its work at python.org 
(seems unlikely), or on my student's computer (seems more likely, though still 
rather absurd)?

Follow-up questions: if I need a more current GCC for my student's Mac, how do 
I obtain it?  And are there any backwards-compatibility issues I might need to 
worry about if I do upgrade?  From my Linux experience, upgrading GCC has never 
caused problems.  But I want to be cautious, since this isn't my computer I'll 
be playing with, but someone else's.

Thanks for any advice you may have.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to load test a web app?

2013-11-06 Thread Skip Montanaro
> Have a look at selenium and sauce labs:
>
> http://www.seleniumhq.org/
> https://saucelabs.com/

Maybe we should pass that information along to Kathleen Sebelius. :-)

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Py 3.3.2, MacBookPro, segmentation fault, GCC issue?

2013-11-06 Thread Mark Lawrence

On 06/11/2013 18:15, John Ladasky wrote:

I am trying to help a student of mine install Python 3 on his MacBook Pro.  The 
installation succeeds.  However, upon opening the Python interpreter, he can only execute 
one Python command successfully.  On the second command, the interpreter crashes, giving 
the error "Segmentation fault: 11".

I have installed Python 3 on Linux and on Windows before, but I have no prior 
experience with Macs.  I know that OSX is Unix-like, but I'm sure that there 
are significant differences between the Linux that I normally use and OSX.

My student's computer is configured as follows: MacBook Pro, 2.5 GHz Intel Core 
i5, 4 GB RAM 1600 MHz DDR3, OS X 10.9.  We installed the Python 3.3.2 Mac OS X 
64-bit/32-bit x86-64/i386 Installer (for Mac OS X 10.6 and later) from 
http://python.org/download.

The Python interpreter reported the following when it was opened:

Python 3.3.2 : d047928ae3f6, May 13 2013, 13:52:24
GCC 4.2.1 (Apple Inc. build 5666) (dot3) on darwin

I do not know exactly how the Mac installer works.  It seemed to operate 
quickly.  It reported very little about what work it was actually doing.  Does 
it install pre-compiled binaries, or does it actually build Python locally from 
source code?  GCC 4.2.1 strikes me as OLD.  According to 
http://gcc.gnu.org/releases.html, it was released in 2007!  I would guess that 
the segfault is occurring because the Python interpreter was compiled using an 
outdated GCC.

First question: did this outdated compiler execute its work at python.org 
(seems unlikely), or on my student's computer (seems more likely, though still 
rather absurd)?

Follow-up questions: if I need a more current GCC for my student's Mac, how do 
I obtain it?  And are there any backwards-compatibility issues I might need to 
worry about if I do upgrade?  From my Linux experience, upgrading GCC has never 
caused problems.  But I want to be cautious, since this isn't my computer I'll 
be playing with, but someone else's.

Thanks for any advice you may have.



http://bugs.python.org/issue18458

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: Slicing with negative strides

2013-11-06 Thread Peter Cacioppi
On Monday, October 28, 2013 10:22:00 PM UTC-7, Steven D'Aprano wrote:
> Does anyone here use slices (or range/xrange) with negative strides other 
> 
> than -1?
> 

Non default positive strides are very handy, but negative strides seem weird to 
me. Not the negative striding exactly, but the way fenceposts and negative 
strides interact.

For example, this poster seems to posit a canonical WTF with negative strides. 

http://stackoverflow.com/questions/5798136/python-reverse-stride-slicing

I can almost picture Picard saying "WTF do you need to omit the end index to 
get the zero element??!!"

Readability counts, no? Just reverse it and use positive strides. 





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


Immediate Opening (Sr C++ / Linux Developer / Lead)

2013-11-06 Thread parker . svksystems
Hi,

Immediate Opening (Sr C++ / Linux Developer / Lead)

Location: Barrington, IL 

Employment Type: Contract 

Mandatory Skills  

Linux Expert, Multi-Threading, C++, Good Communication skills, Agile, Scrum, 
Design Patterns

Desired Skills
MFC 

Job Responsibilities
Minimum 8-10 years experience needed
•   Get technical designs reviewed and approved by client architects
•   Provide oversight to testing team
•   Help manage infrastructure needs and issues
•   Create Class Diagram 
•   Knowledge of Design Patterns
•   Implement Design patterns
•   OOP’s and layered architecture
•   Multithreading, synchronization objects
•   Identifying memory leaks and keeping track of code health
•   Code Optimization and Socket Programming
•   In depth, hands on experience on Linux development


Thanks and Regards
Petter Parker
Technical Recruiter
11465 Johns Creek Pkway, Johns Creek, GA 30097
Phone # 678-824-7785
par...@svksystems.com  || krishnacarrires.svksystems.com (Gtalk) || 
petter.parker123  (Skype) || www.svksystems.com (Company mail ID)


Microsoft Certified Partner | Oracle Certified Partner | E-Verified Company


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


Re: how to load test a web app?

2013-11-06 Thread William Ray Wing
On Nov 6, 2013, at 1:25 PM, Skip Montanaro  wrote:

>> Have a look at selenium and sauce labs:
>> 
>> http://www.seleniumhq.org/
>> https://saucelabs.com/
> 
> Maybe we should pass that information along to Kathleen Sebelius. :-)
> 
> Skip

Definitely!  Anyone seen the cover of this week's issue of the New Yorker?  
http://archives.newyorker.com/#folio=0C1

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


Re: Py 3.3.2, MacBookPro, segmentation fault, GCC issue?

2013-11-06 Thread John Ladasky
Thanks, Mark.

Reading through the information in your link, I appear to have encountered an 
actual bug specific to Python 3.3.2 and OS X 10.9.  And it appears that the 
3.3.3 version of Python that fixes this bug is still in beta.  And that I can 
have my student download the working version from here:

http://www.python.org/download/releases/3.3.3/

Does that all sound correct?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Py 3.3.2, MacBookPro, segmentation fault, GCC issue?

2013-11-06 Thread Mark Lawrence

On 06/11/2013 20:47, John Ladasky wrote:

Thanks, Mark.

Reading through the information in your link, I appear to have encountered an 
actual bug specific to Python 3.3.2 and OS X 10.9.  And it appears that the 
3.3.3 version of Python that fixes this bug is still in beta.  And that I can 
have my student download the working version from here:

http://www.python.org/download/releases/3.3.3/

Does that all sound correct?



Very close :)  The 3.3.3 version is actually a release candidate.  In 
other words if no problems get reported it'll get a full release, if 
there are problems there may be a second release candidate depending on 
the severity.  That's all down to the release manager.  As your student 
appears to be up the creek without a paddle and has a hole in the bottom 
of the canoe, I suggest you get them going with this release.


Slight aside, would you please quote context when you reply, TIA.

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: To whoever hacked into my Database

2013-11-06 Thread Νίκος Γκρ33κ

Στις 6/11/2013 5:25 μμ, ο/η Νίκος Γκρ33κ έγραψε:

Okey let the hacker try again to mess with my database!!!

He is done it twice, lets see if he will make it again!

I'am waiting!


No luck yet mighty one? :)
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python on a MacBook Pro (not my machine)

2013-11-06 Thread Cameron Simpson
On 06Nov2013 09:51, John Ladasky  wrote:
> I just wanted to say thank you to everyone who posted here with 
> recommendations for programming-friendly text editors.  I will follow up on 
> this after I have resolved a more fundamental issue with my new student -- 
> his Python 3.3.2 interpreter segfaults and crashes on the second command!  
> I'll start a new thread to deal with that problem.

I think there was some discussion of this bug with Mavericks very
recently on the list. Possibly fixed in more recent builds.

Cheers,
-- 
Cameron Simpson 

Uhlmann's Razor: When stupidity is a sufficient explanation, there is no need
 to have recourse to any other.
- Michael M. Uhlmann, assistant attorney general
  for legislation in the Ford Administration
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread mm0fmf

On 06/11/2013 21:26, Νίκος Γκρ33κ wrote:

Στις 6/11/2013 5:25 μμ, ο/η Νίκος Γκρ33κ έγραψε:

Okey let the hacker try again to mess with my database!!!

He is done it twice, lets see if he will make it again!

I'am waiting!


No luck yet mighty one? :)


Nikos, just in case you don't understand what you are doing... you're 
issuing a challenge that you are happy for people to try to hack your 
website. You're doing it in a public newsgroup too.


The regular readers of this group may try, they may be playful with your 
files and not do anything that is hard to undo. But someone may decide 
to really screw things for you and you've got no comeback. You issued a 
challenge to the whole world. Don't complain if someone goes full tilt.


I hope you have some backups, I think you may find you need them.

p.s. It wont be me... I have better things to do.





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


Re: To whoever hacked into my Database

2013-11-06 Thread Mark Lawrence

On 06/11/2013 21:26, Νίκος Γκρ33κ wrote:

Στις 6/11/2013 5:25 μμ, ο/η Νίκος Γκρ33κ έγραψε:

Okey let the hacker try again to mess with my database!!!

He is done it twice, lets see if he will make it again!

I'am waiting!


No luck yet mighty one? :)


So you're proud of the fact that you've only been hacked twice (that you 
know of)?  You think you've prevented this happening again.  Pride comes 
before a fall!  Unfortunately for you I suspect that you've so irritated 
someone here by your behaviour that your latest comment is like waving a 
red flag at a bull.  I sincerely hope that this time she destroys your 
site, as it seems likely that this is the only way in which you will 
learn.  Cruel to be kind.


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: how to load test a web app?

2013-11-06 Thread Gene Heskett
On Wednesday 06 November 2013 16:10:40 Skip Montanaro did opine:

> > Have a look at selenium and sauce labs:
> > 
> > http://www.seleniumhq.org/
> > https://saucelabs.com/
> 
> Maybe we should pass that information along to Kathleen Sebelius. :-)
> 
> Skip

I seriously doubt it would do much good.  I had a wife like her for 17 
years.  She carried that famous 2 line sign about the boss is always right.
When she left, I bought a 6 pack to celebrate.  I could finally be right in 
my own house.  Even if I was wrong.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

Punishment becomes ineffective after a certain point.  Men become 
insensitive.
-- Eneg, "Patterns of Force", stardate 2534.7
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Grant Edwards
On 2013-11-06, Mark Lawrence  wrote:
> On 06/11/2013 21:26, ?? ??33?? wrote:
>>  6/11/2013 5:25 , ??/?? ?? ??33?? :
>>> Okey let the hacker try again to mess with my database!!!
>>>
>>> He is done it twice, lets see if he will make it again!
>>>
>>> I'am waiting!
>>
>> No luck yet mighty one? :)
>
> So you're proud of the fact that you've only been hacked twice (that you 
> know of)?  You think you've prevented this happening again.  Pride comes 
> before a fall!  Unfortunately for you I suspect that you've so irritated 
> someone here by your behaviour that your latest comment is like waving a 
> red flag at a bull.  I sincerely hope that this time she destroys your 
> site, as it seems likely that this is the only way in which you will 
> learn.

Waving red flags at female bulls is rarely dangerous.  ;)

-- 
Grant Edwards   grant.b.edwardsYow! Bo Derek ruined
  at   my life!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to load test a web app?

2013-11-06 Thread Mark Lawrence

On 06/11/2013 18:25, Skip Montanaro wrote:

Have a look at selenium and sauce labs:

http://www.seleniumhq.org/
https://saucelabs.com/


Maybe we should pass that information along to Kathleen Sebelius. :-)

Skip



Was she also involved with the nectar search toolbar?

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: To whoever hacked into my Database

2013-11-06 Thread Johannes Findeisen
On Wed, 06 Nov 2013 23:26:26 +0200
Νίκος Γκρ33κ wrote:

> Στις 6/11/2013 5:25 μμ, ο/η Νίκος Γκρ33κ έγραψε:
> > Okey let the hacker try again to mess with my database!!!
> >
> > He is done it twice, lets see if he will make it again!
> >
> > I'am waiting!
> 
> No luck yet mighty one? :)

I am very new to this list but what I can say is, that I never since
1999 have seen a person going on like you do.  People here a very
friendly and are helping everybody from a beginner to a pro.  Mostly
pros are answering the questions here and that's a huge benefit for a
community.  What you are doing is absurd!  You don't seem to follow the
answers and are asking same questions over and over without paying
attention to thoose people here helping you out for free.  Now since you
know that nobody will invest time helping out on your problems you
start trolling.  That is not fair and asking people to hack your site
in a public forum is just wrong; It is a big fail!

Please stop writing to this list if you not follow what people are
answering to you here.  I need to say, I am not a good software
developer but your code is totally stupid.  You can do it that way but
when people are giving you hints on how to learn how to do you should
follow that.  I think there is no programming language available that
will help you fix your problems the right way.  The right way is not
the programming language but the developer who writing the code has to
do it right.  Read code from other projects around the web to learn,
read the beginners guide and start with some tutorials.

If I would sell hosting packages like you do I could not sleep well at
night if I know I have such lame skills in understanding of security,
programming and computer systems.

Be careful what you do!

Sleep well,
Johannes
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Tim Chase
On 2013-11-06 22:22, Grant Edwards wrote:
> Waving red flags at female bulls is rarely dangerous.  ;)

though I still wouldn't recommend it if you're COWardly :-)

Well, maybe the issue is MOOt.

-tkc


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


Re: To whoever hacked into my Database

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 9:34 AM, Tim Chase  wrote:
> On 2013-11-06 22:22, Grant Edwards wrote:
>> Waving red flags at female bulls is rarely dangerous.  ;)
>
> though I still wouldn't recommend it if you're COWardly :-)
>
> Well, maybe the issue is MOOt.

Ugh, if only these puns were like CALF-way funny...

*dives for cover*

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Immediate Opening (Sr C++ / Linux Developer / Lead)

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 6:32 AM,   wrote:
> Immediate Opening (Sr C++ / Linux Developer / Lead)
>
> Thanks and Regards
> Petter Parker

Normally we'd ask job postings to be redirected to the Python Job
Board, but this one doesn't appear to have anything to do with Python
at all. However, the possibility of working for "Spidder-Man" might
attract people... you never know.

But mainly, this is quite off-topic for this list, so please consider
alternative channels. :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Mark Lawrence

On 06/11/2013 22:54, Chris Angelico wrote:

On Thu, Nov 7, 2013 at 9:34 AM, Tim Chase  wrote:

On 2013-11-06 22:22, Grant Edwards wrote:

Waving red flags at female bulls is rarely dangerous.  ;)


though I still wouldn't recommend it if you're COWardly :-)

Well, maybe the issue is MOOt.


Ugh, if only these puns were like CALF-way funny...

*dives for cover*

ChrisA



I hereby profoundly apologise to the entire list for having set Mr. 
Edwards, Mr. Chase and Mr. Angelico down this path.


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: To whoever hacked into my Database

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 10:52 AM, Mark Lawrence  wrote:
> On 06/11/2013 22:54, Chris Angelico wrote:
>>
>> On Thu, Nov 7, 2013 at 9:34 AM, Tim Chase 
>> wrote:
>>>
>>> On 2013-11-06 22:22, Grant Edwards wrote:

 Waving red flags at female bulls is rarely dangerous.  ;)
>>>
>>>
>>> though I still wouldn't recommend it if you're COWardly :-)
>>>
>>> Well, maybe the issue is MOOt.
>>
>>
>> Ugh, if only these puns were like CALF-way funny...
>>
>> *dives for cover*
>>
>> ChrisA
>>
>
> I hereby profoundly apologise to the entire list for having set Mr. Edwards,
> Mr. Chase and Mr. Angelico down this path.

Yeah, I was a bit iffy about continuing that line. Inside my head, a
voice asked, "Dare he?" And alas for the list, the response was:
"DAIRY not?"

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Show off your Python chops and compete with others

2013-11-06 Thread Nathaniel Sokoll-Ward
Thought this group would appreciate this: www.metabright.com/challenges/python

MetaBright makes skill assessments to measure how talented people are at 
different skills. And recruiters use MetaBright to find outrageously skilled 
job candidates.

Python is a new area of expertise for us. We make "Challenges" for a bunch of 
languages and we're excited to finally have Python released. Give it a shot -- 
I'd love to hear what you think.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Mark Lawrence

On 06/11/2013 23:57, Chris Angelico wrote:

On Thu, Nov 7, 2013 at 10:52 AM, Mark Lawrence  wrote:

On 06/11/2013 22:54, Chris Angelico wrote:


On Thu, Nov 7, 2013 at 9:34 AM, Tim Chase 
wrote:


On 2013-11-06 22:22, Grant Edwards wrote:


Waving red flags at female bulls is rarely dangerous.  ;)



though I still wouldn't recommend it if you're COWardly :-)

Well, maybe the issue is MOOt.



Ugh, if only these puns were like CALF-way funny...

*dives for cover*

ChrisA



I hereby profoundly apologise to the entire list for having set Mr. Edwards,
Mr. Chase and Mr. Angelico down this path.


Yeah, I was a bit iffy about continuing that line. Inside my head, a
voice asked, "Dare he?" And alas for the list, the response was:
"DAIRY not?"

ChrisA



That was so bad I somehow managed to recall this "What we have here is a 
clear case of Mann's inhumanity to Mann" - John Arlott commenting on 
South African bowler "Tufty" Mann causing England batsman George Mann 
problems.


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: Python on a MacBook Pro (not my machine)

2013-11-06 Thread Jake Angulo
I use a Macbook air for programming - yes it has Python 2.x in it.

For code editing i use a combination of:
1) Wing IDE 101
(from their website: "is free scaled down Python IDE designed for teaching
introductory programming classes")
2) Sublime Text
3) Good old Vi

You could try those


On Thu, Nov 7, 2013 at 8:34 AM, Cameron Simpson  wrote:

> On 06Nov2013 09:51, John Ladasky  wrote:
> > I just wanted to say thank you to everyone who posted here with
> recommendations for programming-friendly text editors.  I will follow up on
> this after I have resolved a more fundamental issue with my new student --
> his Python 3.3.2 interpreter segfaults and crashes on the second command!
>  I'll start a new thread to deal with that problem.
>
> I think there was some discussion of this bug with Mavericks very
> recently on the list. Possibly fixed in more recent builds.
>
> Cheers,
> --
> Cameron Simpson 
>
> Uhlmann's Razor: When stupidity is a sufficient explanation, there is no
> need
>  to have recourse to any other.
> - Michael M. Uhlmann, assistant attorney general
>   for legislation in the Ford Administration
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Andrew Cooper
On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote:
> Thought this group would appreciate this: www.metabright.com/challenges/python
> 
> MetaBright makes skill assessments to measure how talented people are at 
> different skills. And recruiters use MetaBright to find outrageously skilled 
> job candidates.
> 
> Python is a new area of expertise for us. We make "Challenges" for a bunch of 
> languages and we're excited to finally have Python released. Give it a shot 
> -- I'd love to hear what you think.
> 

"What is the correct number of spaces for indentation in Python?"

I presume the question should be more along the lines of "What does PEP8
say?", because all answers are correct.

"String literals are written with what?"

The answer is not "ALl of these answers are correct"


So two of of 7 questions with wrong answers so far...

~Andrew
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Roy Smith
In article ,
 Andrew Cooper  wrote:

> On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote:
> > Thought this group would appreciate this: 
> > www.metabright.com/challenges/python
> > 
> > MetaBright makes skill assessments to measure how talented people are at 
> > different skills. And recruiters use MetaBright to find outrageously 
> > skilled job candidates.
> > 
> > Python is a new area of expertise for us. We make "Challenges" for a bunch 
> > of languages and we're excited to finally have Python released. Give it a 
> > shot -- I'd love to hear what you think.
> > 
> 
> "What is the correct number of spaces for indentation in Python?"




What does the following code do?
def a(b, c, d): pass

My answer: "Defines a function which returns None", but that isn't one 
of the choices.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Andrew Cooper
On 07/11/2013 00:24, Roy Smith wrote:
> In article ,
>  Andrew Cooper  wrote:
> 
>> On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote:
>>> Thought this group would appreciate this: 
>>> www.metabright.com/challenges/python
>>>
>>> MetaBright makes skill assessments to measure how talented people are at 
>>> different skills. And recruiters use MetaBright to find outrageously 
>>> skilled job candidates.
>>>
>>> Python is a new area of expertise for us. We make "Challenges" for a bunch 
>>> of languages and we're excited to finally have Python released. Give it a 
>>> shot -- I'd love to hear what you think.
>>>
>>
>> "What is the correct number of spaces for indentation in Python?"
> 
> 
> 
> 
> What does the following code do?
> def a(b, c, d): pass
> 
> My answer: "Defines a function which returns None", but that isn't one 
> of the choices.
> 

"Which is a correct way to perform exponentiation in Python?"

1) math.pow(a,b)
2) a^b
3) a*2b
4) None of the other responses are correct

Apparently I was wrong by answering 4), and 1) is the expected answer.
Clearly the author doesn't know about the ** operator in python.


It appears that no serious python coders were consulted when writing
these questions.

~Andrew
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Gene Heskett
On Wednesday 06 November 2013 18:19:17 Chris Angelico did opine:

> On Thu, Nov 7, 2013 at 9:34 AM, Tim Chase  
wrote:
> > On 2013-11-06 22:22, Grant Edwards wrote:
> >> Waving red flags at female bulls is rarely dangerous.  ;)
> > 
> > though I still wouldn't recommend it if you're COWardly :-)
> > 
> > Well, maybe the issue is MOOt.
> 
> Ugh, if only these puns were like CALF-way funny...
> 
Or even MOOving.

> *dives for cover*

Leave room for me.  Please.
 
> ChrisA


Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

QOTD:
"He eats like a bird... five times his own weight each day."
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Mark Lawrence

On 07/11/2013 00:28, Andrew Cooper wrote:

On 07/11/2013 00:24, Roy Smith wrote:

In article ,
  Andrew Cooper  wrote:


On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote:

Thought this group would appreciate this:
www.metabright.com/challenges/python

MetaBright makes skill assessments to measure how talented people are at
different skills. And recruiters use MetaBright to find outrageously
skilled job candidates.

Python is a new area of expertise for us. We make "Challenges" for a bunch
of languages and we're excited to finally have Python released. Give it a
shot -- I'd love to hear what you think.



"What is the correct number of spaces for indentation in Python?"





What does the following code do?
def a(b, c, d): pass

My answer: "Defines a function which returns None", but that isn't one
of the choices.



"Which is a correct way to perform exponentiation in Python?"

1) math.pow(a,b)
2) a^b
3) a*2b
4) None of the other responses are correct

Apparently I was wrong by answering 4), and 1) is the expected answer.
Clearly the author doesn't know about the ** operator in python.


It appears that no serious python coders were consulted when writing
these questions.

~Andrew



So that narrows the search for the culprit down to our Greek aquaintance? :)

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: To whoever hacked into my Database

2013-11-06 Thread Ethan Furman

On 11/06/2013 03:57 PM, Chris Angelico wrote:

On Thu, Nov 7, 2013 at 10:52 AM, Mark Lawrence wrote:

On 06/11/2013 22:54, Chris Angelico wrote:

On Thu, Nov 7, 2013 at 9:34 AM, Tim Chase wrote:

On 2013-11-06 22:22, Grant Edwards wrote:


Waving red flags at female bulls is rarely dangerous.  ;)


though I still wouldn't recommend it if you're COWardly :-)

Well, maybe the issue is MOOt.


Ugh, if only these puns were like CALF-way funny...

*dives for cover*


I hereby profoundly apologise to the entire list for having set Mr. Edwards,
Mr. Chase and Mr. Angelico down this path.


Yeah, I was a bit iffy about continuing that line. Inside my head, a
voice asked, "Dare he?" And alas for the list, the response was:
"DAIRY not?"


AH hahahahahahahaha.

Not only the OP (which I missed, 'cause he's a troll) was absolutely hilarious, but this part of the thread has made my 
day.  I guess trolls can (rarely) have good side effects.  :)


--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
 wrote:
> Thought this group would appreciate this: www.metabright.com/challenges/python
>
> MetaBright makes skill assessments to measure how talented people are at 
> different skills. And recruiters use MetaBright to find outrageously skilled 
> job candidates.
>
> Python is a new area of expertise for us. We make "Challenges" for a bunch of 
> languages and we're excited to finally have Python released. Give it a shot 
> -- I'd love to hear what you think.

"""How could you open a file c:\scores.dat to write in binary?

outfile = open("c:\\scores.dat", "w")
outfile = open("c:\scores.dat", "a")
outfile = open("c:\\scores.dat", "w")
outfile = open("c:\\scores.dat", "wb")"""

Not technically wrong, but stylistically suspect; I would recommend
using forward slashes (which work fine on Windows) and avoiding the
drive letter, both of which avoid making your example
Windows-specific. (At least, I don't think there are any other
platforms Python supports that use drive letters; OS/2 support was
dropped a little while ago, though I believe Paul Smedley still
maintains a port. But I digress.)

"""Which method will write a pickled representation of the object to
an open file?"""

Method names without object names aren't all that useful. Do you mean
"Which method of the pickle module..."?

"""From which languages are Python classes derived from?"""

Sounds like Python history trivia more than a coding challenge, but if
that's what you want to go for, sure.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Help with my programming homework (python, and raptor)

2013-11-06 Thread jonny seelye
Employee Salaries
You are working for a medium sized construction company as an intern in 
the Information Technology department.  A director in the Human Resources 
department recently asked the IT department to write a small program that will 
help them do a salary comparison.  The program needs to be able to enter the 
name of the employee and their salary.  Once the data is loaded the program 
needs to find the average salary, the highest salary and the lowest salary.  
The program needs to print out these values along with the names of the 
employees that go along with the salary.
Your boss, who has great trust in you and your programming abilities, 
has given this project to you.  You, therefore, schedule a meeting with the HR 
director asking for the program to clarify the program’s requirements.  After 
your meeting you have summarized the following:
The program needs to ask for how many employees and salaries the 
program will be working with.  The program needs to do some data validation on 
this number to make sure it is a positive number.
The program needs to ask for the name of each employee along with their 
salary.  Since the name of the employee will be a string and the salary will be 
a number, you decide to use two parallel arrays to store the data.  The program 
will need to do some data validation on the salary to make sure it is a number 
and greater than 0 and less than $200,000.
The program will determine what the average salary is and print that 
out to the user.
The program will determine what salary is the lowest and print that out 
along with the name of the employee who has that salary figure.
The program will determine what salary is the highest and print that 
out along with the name of the employee who has that salary figure.


Use the following test data to test your program.
Employee Name   Salary  
John$45,600 Average Salary: $63, 862.50
Sue $55,400 Highest Salary: $89,750
David   $64,700 Lowest Salary:  $45,600
Betty   $89,750 

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


Re: Show off your Python chops and compete with others

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
 wrote:
> Thought this group would appreciate this: www.metabright.com/challenges/python
>
> MetaBright makes skill assessments to measure how talented people are at 
> different skills. And recruiters use MetaBright to find outrageously skilled 
> job candidates.
>
> Python is a new area of expertise for us. We make "Challenges" for a bunch of 
> languages and we're excited to finally have Python released. Give it a shot 
> -- I'd love to hear what you think.

By the way, here's a fairly bad solution to your final question:

array666=lambda x:b"\6\6\6" in bytes(x)

Works for the given test-cases! Doesn't work with arrays at all,
despite the description.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with my programming homework (python, and raptor)

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 11:56 AM, jonny seelye  wrote:
> Employee Salaries
> Use the following test data to test your program.
> Employee Name   Salary
> John$45,600 Average Salary: $63, 862.50
> Sue $55,400 Highest Salary: $89,750
> David   $64,700 Lowest Salary:  $45,600
> Betty   $89,750

We're not a "do your homework for you" list. Start by writing as much
as you can yourself, then figure out exactly where you're stuck and
ask a specific question. We're happy to help you learn Python - that's
the future of programming anyway - and so we will not help you to
not-learn Python by getting someone else to do your work. Nobody here
wants to turn you into a course-qualified but utterly incompetent
programmer :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread MRAB

On 07/11/2013 00:59, Chris Angelico wrote:

On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
 wrote:

Thought this group would appreciate this: www.metabright.com/challenges/python

MetaBright makes skill assessments to measure how talented people are at 
different skills. And recruiters use MetaBright to find outrageously skilled 
job candidates.

Python is a new area of expertise for us. We make "Challenges" for a bunch of 
languages and we're excited to finally have Python released. Give it a shot -- I'd love 
to hear what you think.


"""How could you open a file c:\scores.dat to write in binary?

outfile = open("c:\\scores.dat", "w")
outfile = open("c:\scores.dat", "a")
outfile = open("c:\\scores.dat", "w")
outfile = open("c:\\scores.dat", "wb")"""

Not technically wrong, but stylistically suspect; I would recommend
using forward slashes (which work fine on Windows) and avoiding the
drive letter, both of which avoid making your example
Windows-specific. (At least, I don't think there are any other
platforms Python supports that use drive letters; OS/2 support was
dropped a little while ago, though I believe Paul Smedley still
maintains a port. But I digress.)

"""Which method will write a pickled representation of the object to
an open file?"""

Method names without object names aren't all that useful. Do you mean
"Which method of the pickle module..."?

"""From which languages are Python classes derived from?"""


Does it really have the word "from" twice?


Sounds like Python history trivia more than a coding challenge, but if
that's what you want to go for, sure.



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


Re: Show off your Python chops and compete with others

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 12:12 PM, MRAB  wrote:
>> """From which languages are Python classes derived from?"""
>>
> Does it really have the word "from" twice?

You know, I didn't even notice that. But since that was copied and
pasted, I would say that yes, it really does. That's a pretty simple
grammatical bugfix though.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread John Nagle
On 11/6/2013 5:04 PM, Chris Angelico wrote:
> On Thu, Nov 7, 2013 at 11:00 AM, Nathaniel Sokoll-Ward
>  wrote:
>> Thought this group would appreciate this: 
>> www.metabright.com/challenges/python
>>
>> MetaBright makes skill assessments to measure how talented people are at 
>> different skills. And recruiters use MetaBright to find outrageously skilled 
>> job candidates.

   With tracking cookies blocked, you get 0 points.

John Nagle
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread John Ladasky
On Wednesday, November 6, 2013 4:00:57 PM UTC-8, Nathaniel Sokoll-Ward wrote:
> Thought this group would appreciate this: www.metabright.com/challenges/python

I have to concur with what several other people are saying here.  Several of 
MetaBright's questions are ambiguously worded, or expect non-idiomatic Python 
code.  It might be helpful for you to ask (hire?) some seasoned Python 
programmers to critique your questions.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 12:55 PM, John Ladasky
 wrote:
> On Wednesday, November 6, 2013 4:00:57 PM UTC-8, Nathaniel Sokoll-Ward wrote:
>> Thought this group would appreciate this: 
>> www.metabright.com/challenges/python
>
> I have to concur with what several other people are saying here.  Several of 
> MetaBright's questions are ambiguously worded, or expect non-idiomatic Python 
> code.  It might be helpful for you to ask (hire?) some seasoned Python 
> programmers to critique your questions.

No need to hire anyone, just posting the questions here will generate
exactly such a critique - as evidenced by this thread :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with my programming homework (python, and raptor)

2013-11-06 Thread Denis McMahon
On Wed, 06 Nov 2013 16:56:26 -0800, jonny seelye wrote:

> Since the name of the employee will be a string and the
> salary will be a number, you decide to use two parallel 
> arrays to store the data.

The hell I do! I decide to do this:

# data initialisation

minsal = maxsal = sumsal = 0.0
minpers = []
maxpers = []

# employee and salary input processing

get the number of employees
check the number is > 0

for 1 to number of employees
get the name
get the salary

if minsal == 0.0
note minsal
set the minpers list to name
else if salary < minsal
note minsal
set the minpers list to name
else if salary == minsal
append name to the minpers list

similar for maxsal & maxpers

sumsal += salary

# outputs

average salary = # calculate

maximum salary = 
people receiving = 

similar for minimum

I might have missed something from the original spec, but as I recall, 
you just wanted min, max and avg salaries, and to know who was getting 
the min and max, yes?

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread nikos sucks
Nikos said:
> Okey let the hacker try again to mess with my database!!!
> He is done it twice, lets see if he will make it again!
> I'am waiting!

Seriously man, you gotta stop. Are you trying to be a host provider? You
know absolutely nothing about what you are doing. There are security holes
everywhere in your site. Take someones advise for once. Your whole project
is a disaster because you haven't taken the time to read and learn about
the tools you are using. You're expecting python-list to code your site for
you (one messed up error-fix at a time), and it's ridiculous.

Read a book, or look at other peoples code and learn from it. Your first
reaction to a bug should not be to send 3 emails to python-list asking the
same thing over and over.

Here, I'm gonna get you started:
http://lmgtfy.com/?q=how+not+to+suck+as+a+person+and+a+developer
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Tim Chase
On 2013-11-07 10:57, Chris Angelico wrote:
>  Waving red flags at female bulls is rarely dangerous.  ;)
> >>>
> >>> though I still wouldn't recommend it if you're COWardly :-)
> >>>
> >>> Well, maybe the issue is MOOt.
> >>
> >> Ugh, if only these puns were like CALF-way funny...
> >
> > I hereby profoundly apologise to the entire list for having set
> > Mr. Edwards, Mr. Chase and Mr. Angelico down this path.
> 
> Yeah, I was a bit iffy about continuing that line. Inside my head, a
> voice asked, "Dare he?" And alas for the list, the response was:
> "DAIRY not?"

Well, I would if I cud...

-tkc



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


Re: Show off your Python chops and compete with others

2013-11-06 Thread Tim Chase
On 2013-11-06 17:31, John Nagle wrote:
> >> MetaBright makes skill assessments to measure how talented
> >> people are at different skills. And recruiters use MetaBright to
> >> find outrageously skilled job candidates.  
> 
> With tracking cookies blocked, you get 0 points.

And with JavaScript blocked, you get bupkis. :-)

I was amused that the sidebar of similar challenges suggested that
the Python challenge might be similar to this one.  Ya think?  So
similar that even the URL is the same...

-tkc



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


i want to know about python language

2013-11-06 Thread Kewl p
h
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: i want to know about python language

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 2:18 PM, Kewl p  wrote:
> h

You've come to the right place, but (as the Princess Ida put it) the
subject's deep - how should we treat it, pray?

I recommend you start with the Python tutorial:
http://docs.python.org/3/tutorial/
and when you've worked through that, you'll be able to ask more
specific questions.

All the best!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To whoever hacked into my Database

2013-11-06 Thread Chris Angelico
On Thu, Nov 7, 2013 at 11:22 AM, Ethan Furman  wrote:
> Not only the OP (which I missed, 'cause he's a troll) was absolutely
> hilarious, but this part of the thread has made my day.  I guess trolls can
> (rarely) have good side effects.  :)

I could continue with the puns, but it'd just be MILKing it now...

*leaves room for Gene*

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: i want to know about python language

2013-11-06 Thread Kewl p
On Thursday, November 7, 2013 8:48:26 AM UTC+5:30, Kewl p wrote:
> h

thanks very much
-- 
https://mail.python.org/mailman/listinfo/python-list


How to parse JSON passed on the command line?

2013-11-06 Thread Anthony Papillion
Hello Everyone,

I'm writing a little helper script in Python that will access a JSON
formatted argument from the shell when it's called. The parameter will
look like this:

{"url":"http://www.google.com"}

So, if my program is called "getargfromcli.py" the call will look like this:

getargfromcli.py {"url":"http://www.google.com"}

In the case above, I assume my JSON string will be argv[1]. In fact,
when I do

print sys.argv[1]

It works as expected and prints out the JSON string as expected like
this: {url:http://www.google.com}

Now, for the harder part. When I try to PARSE this JSON using this code:

json_string = json.loads(sys.argv[1])

I get an error saying that "No JSON object could be decoded".  Even
though this looks like valid JSON and was generated by a JSON generator.

Can anyone tell me what I'm doing wrong? Basically, I want to eventually
get the value of url into a string.

Thanks!
anthony

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


Re: How to parse JSON passed on the command line?

2013-11-06 Thread Chris Rebert
On Wed, Nov 6, 2013 at 7:53 PM, Anthony Papillion  wrote:
> Hello Everyone,
>
> I'm writing a little helper script in Python that will access a JSON
> formatted argument from the shell when it's called. The parameter will
> look like this:
>
> {"url":"http://www.google.com"}
>
> So, if my program is called "getargfromcli.py" the call will look like this:
>
> getargfromcli.py {"url":"http://www.google.com"}

You probably want
getargfromcli.py '{"url":"http://www.google.com"}'
instead, so that your string of JSON is treated literally by the shell.

> In the case above, I assume my JSON string will be argv[1]. In fact,
> when I do
>
> print sys.argv[1]
>
> It works as expected and prints out the JSON string as expected like
> this: {url:http://www.google.com}

No, that's not JSON anymore! All the required quotation marks have
gone missing. The shell ate them.

Regards,
Chris
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to parse JSON passed on the command line?

2013-11-06 Thread Roy Smith
In article ,
 Anthony Papillion  wrote:

> Hello Everyone,
> 
> I'm writing a little helper script in Python that will access a JSON
> formatted argument from the shell when it's called. The parameter will
> look like this:
> 
> {"url":"http://www.google.com"}
> 
> So, if my program is called "getargfromcli.py" the call will look like this:
> 
> getargfromcli.py {"url":"http://www.google.com"}
> 
> In the case above, I assume my JSON string will be argv[1]. In fact,
> when I do
> 
> print sys.argv[1]
> 
> It works as expected and prints out the JSON string as expected like
> this: {url:http://www.google.com}

Which is not valid JSON.  You lost the quotes.  I suspect you want to
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to parse JSON passed on the command line?

2013-11-06 Thread yupeng zhang
在 2013年11月7日星期四UTC+8上午11时53分09秒,Anthony Papillion写道:
> Hello Everyone,
> 
> 
> 
> I'm writing a little helper script in Python that will access a JSON
> 
> formatted argument from the shell when it's called. The parameter will
> 
> look like this:
> 
> 
> 
> {"url":"http://www.google.com"}
> 
> 
> 
> So, if my program is called "getargfromcli.py" the call will look like this:
> 
> 
> 
> getargfromcli.py {"url":"http://www.google.com"}
> 
> 
> 
> In the case above, I assume my JSON string will be argv[1]. In fact,
> 
> when I do
> 
> 
> 
> print sys.argv[1]
> 
> 
> 
> It works as expected and prints out the JSON string as expected like
> 
> this: {url:http://www.google.com}
> 
> 
> 
> Now, for the harder part. When I try to PARSE this JSON using this code:
> 
> 
> 
> json_string = json.loads(sys.argv[1])
> 
> 
> 
> I get an error saying that "No JSON object could be decoded".  Even
> 
> though this looks like valid JSON and was generated by a JSON generator.
> 
> 
> 
> Can anyone tell me what I'm doing wrong? Basically, I want to eventually
> 
> get the value of url into a string.
> 
> 
> 
> Thanks!
> 
> anthony

Hi Anthony Papillion.
I'm fresh to Python, but I do love its short simple and graceful.
I've solved your problem. You could try the code below:

getargfromcli.py "\"{'url':'http://www.google.com'}\""

AS command line will strip your ".
From the Python document, we could get the info as:
json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')

the json.loads' argument should be string. Try it:)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: i want to know about python language

2013-11-06 Thread Kewl p
On Thursday, November 7, 2013 8:48:26 AM UTC+5:30, Kewl p wrote:
> h

can i get link of a ide in which python can run,,...??
-- 
https://mail.python.org/mailman/listinfo/python-list


Flexible programming environment (was: i want to know about python language)

2013-11-06 Thread Ben Finney
Kewl p  writes:

> On Thursday, November 7, 2013 8:48:26 AM UTC+5:30, Kewl p wrote:
> > h
>
> can i get link of a ide in which python can run,,...??

I recommend learning a programming environment that is *not* tied to a
particular programming language.

Use an environment that lets you edit text files, type arbitrary shell
commands, run a test suite, invoke a debugger, run an interactive
language shell — *without* being specific to any particular language.

For me, that's a terminal emulator, and Emacs. Others prefer a terminal
emulator and Vim. Either are very powerful and very flexible, and have
support for many dozens of languages.

Python does have a Python-specific IDE, called “IDLE”. But if you're
interested in programming, you should be learning tools that let you
continue to use the tool just as effectively when you use more than one
language.

-- 
 \  “I am too firm in my consciousness of the marvelous to be ever |
  `\   fascinated by the mere supernatural …” —Joseph Conrad, _The |
_o__) Shadow-Line_ |
Ben Finney

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