Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Mark Lawrence

On 13/12/2013 03:23, Jean Dubois wrote:


kind regards,
jean
p.s. I'm using Linux/Kubuntu 11.04



Would you please read and action this 
https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the 
double line spacing that accompanied the above, thanks.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: Python Script

2013-12-13 Thread Mark Lawrence

On 13/12/2013 06:21, Amimo Benja wrote:

On Thursday, December 12, 2013 9:35:23 PM UTC+3, Gary Herron wrote:

On 12/12/2013 10:05 AM, Amimo Benja wrote:


I have an issue with a Python script that I will show as follows:



http://codepad.org/G8Z2ConI







Assume that you have three (well defined) classes: AirBase and VmNet, . VmNet 
has got a method that is called recursively each time an HTTP response is 
received. The variable recordTuple needs to be built independently for each 
instance of VmNet that is created. However, the mentioned variable is being 
overwritten across every instance, so if you try to get it from 
vmnet_instance_y, you would get exactly the same than retrieving it from 
vmnet_instance_x.







• What is the code issue? I need to use this script in a project and I don't 
know how to proceed.







Actually, the script aims to follow the principle don't repeat yourself (DRY). 
As you may notice, VmNet and AirBase does not have def __init__(self), so 
self.recordTupleBase does not probably exist. Additionally, many other 
subclasses, similar to VmNet, can implement the recursive method using that 
recordTupleBase.







* I will gladly appreciate any help thanks




You haven't actually asked a question here.  You say you don't know how

to proceed with "a project", but we don't know what that project is.  In

fact, I can't even figure out if your trouble is with the script, or

with using the script in this unknown project.



Also, if you repost, please include the script in the email, not as a

pointer to somewhere else.





Gary Herron


Okay Gary... I will put that into consideration when post another problem or 
solution.



Before you repost would you please read and action this 
https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the 
double line spacing above, thanks.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: Knapsack Problem Without Value

2013-12-13 Thread geezle86
On Friday, December 13, 2013 9:08:56 AM UTC+7, [email protected] wrote:
> Hi,
> 
> 
> 
> I wanna ask about Knapsack. I do understand what Knapsack is about. But this 
> one i faced is a different problem. There is no value. I mean, it's like 
> this, for example.
> 
> 
> 
> I have 4 beams [X0, X1, X2, X3]. Each 1, 2, 2, 3 cm long. I want to make a 
> new 6 cm long connected-beam from these 4 beams. I can make it from some of 
> these. The output will print:
> 
> 
> 
> 1, 2, 3 #(X0, X1, X3)
> 
> 
> 
> You understand what my problem is? Can you help me?
> 
> 
> 
> Sincerely,

No, this isnt homework. There is a website called Jollybee (Its available only 
in Bahasa) Here is the link if you dont believe me 
http://jollybee.binus.ac.id/oj/site/problemset/problem/code/HS10F/

Im just got bored and trying to have fun.

Not values like that, i mean, everywhere, I found the pseudocode only teach me 
with 2 variable. Mostly weight and its values ($). For short, this problem I 
faced is only the weight, no values($).

Hope you get it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Code suggestion - List comprehension

2013-12-13 Thread Peter Otten
Shyam Parimal Katti wrote:

> Hello,
> 
> I have a list of sql queries, some which are split across multiple list
> elements e.x.
> ['drop table sample_table;', 'create table sample_test', '(col1 int);',
> 'select col1 from', ' sample_test;']
> 
> A semi-colon in the string value  indicates the termination of a sql
> query. So the expected out come is a conversion to a list of valid sql
> queries:
> ['drop table sample_table;', 'create table sample_test (col1 int);',
> 'select col1 from sample_test;']
> 
> Here is the code that does that:
> 
> sample = ['drop table sample_table;', 'create table sample_test', '(col1
> int);', 'select col1 from', ' sample_test;']
> pure_sqls = []
> query_holder= ''
> for each_line in sample:
> query_holder += each_line
> if query_holder.endswith(';'):
> pure_sqls.append(query_holder)
> query_holder = ''
> 
> 
> Is there a way to do this by eliminating explicit creation of new
> list(pure_sqls) and a temporary variable(query_holder)? Using list
> comprehension? Though I don't want to put the shorter version in
> production(if it is difficult to understand), I am looking if this can be
> done with list comprehension since I am trying to learn list comprehension
> by using it in such scenarios.

Yours is the sane approach, but it may be fun to try to understand the 
following evil hacks ;)

>>> [sql.replace("\0", " ") + ";" for sql in "\0".join(sample + 
[""]).split(";\0") if sql]
['drop table sample_table;', 'create table sample_test (col1 int);', 'select 
col1 from  sample_test;']


>>> from itertools import groupby
>>> def key(x, group=[0]):
... try:
... return group[0]
... finally:
... group[0] += x.endswith(";")
... 
>>> [" ".join(group) for _, group in groupby(sample, key)]
['drop table sample_table;', 'create table sample_test (col1 int);', 'select 
col1 from  sample_test;']


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


Re: Knapsack Problem Without Value

2013-12-13 Thread Mark Lawrence

On 13/12/2013 09:38, [email protected] wrote:

On Friday, December 13, 2013 9:08:56 AM UTC+7, [email protected] wrote:

Hi,



I wanna ask about Knapsack. I do understand what Knapsack is about. But this 
one i faced is a different problem. There is no value. I mean, it's like this, 
for example.



I have 4 beams [X0, X1, X2, X3]. Each 1, 2, 2, 3 cm long. I want to make a new 
6 cm long connected-beam from these 4 beams. I can make it from some of these. 
The output will print:



1, 2, 3 #(X0, X1, X3)



You understand what my problem is? Can you help me?



Sincerely,


No, this isnt homework. There is a website called Jollybee (Its available only 
in Bahasa) Here is the link if you dont believe me 
http://jollybee.binus.ac.id/oj/site/problemset/problem/code/HS10F/

Im just got bored and trying to have fun.

Not values like that, i mean, everywhere, I found the pseudocode only teach me 
with 2 variable. Mostly weight and its values ($). For short, this problem I 
faced is only the weight, no values($).

Hope you get it.



Would you please read and action this 
https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the 
double line spacing above, thanks.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: Code suggestion - List comprehension

2013-12-13 Thread Mark Lawrence

On 13/12/2013 09:43, Peter Otten wrote:

Shyam Parimal Katti wrote:


Hello,

I have a list of sql queries, some which are split across multiple list
elements e.x.
['drop table sample_table;', 'create table sample_test', '(col1 int);',
'select col1 from', ' sample_test;']

A semi-colon in the string value  indicates the termination of a sql
query. So the expected out come is a conversion to a list of valid sql
queries:
['drop table sample_table;', 'create table sample_test (col1 int);',
'select col1 from sample_test;']

Here is the code that does that:

sample = ['drop table sample_table;', 'create table sample_test', '(col1
int);', 'select col1 from', ' sample_test;']
pure_sqls = []
query_holder= ''
for each_line in sample:
 query_holder += each_line
 if query_holder.endswith(';'):
 pure_sqls.append(query_holder)
 query_holder = ''


Is there a way to do this by eliminating explicit creation of new
list(pure_sqls) and a temporary variable(query_holder)? Using list
comprehension? Though I don't want to put the shorter version in
production(if it is difficult to understand), I am looking if this can be
done with list comprehension since I am trying to learn list comprehension
by using it in such scenarios.


Yours is the sane approach, but it may be fun to try to understand the
following evil hacks ;)


[sql.replace("\0", " ") + ";" for sql in "\0".join(sample +

[""]).split(";\0") if sql]
['drop table sample_table;', 'create table sample_test (col1 int);', 'select
col1 from  sample_test;']



from itertools import groupby
def key(x, group=[0]):

... try:
... return group[0]
... finally:
... group[0] += x.endswith(";")
...

[" ".join(group) for _, group in groupby(sample, key)]

['drop table sample_table;', 'create table sample_test (col1 int);', 'select
col1 from  sample_test;']




Evil?  Bring back the death penalty for code like the above, that's what 
I say :)


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


accessing a page which request an openID authentication

2013-12-13 Thread uni . mail . 2014
I have a page that request an openID authentication "google ID" before you are 
able to download any file from it. 
this is the website "http://oc.gtisc.gatech.edu:8080/search.cgi?search=sality"; 
and I tried a lot but it dose not seem that the ordinary login using session or 
requests work on this case ? any guidance or help ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Jean Dubois
Op vrijdag 13 december 2013 04:32:30 UTC+1 schreef Dan Stromberg:
> On Thu, Dec 12, 2013 at 7:23 PM, Jean Dubois  wrote:
> 
> > Op donderdag 12 december 2013 22:23:22 UTC+1 schreef Dan Stromberg:
> 
> >> On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois  
> >> wrote:
> 
> >>
> 
> >> > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote:
> 
> >>
> 
> >> >> On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois  
> >> >> wrote:
> 
> 
> 
> >> >> For this reason, I wrote 
> >> >> http://stromberg.dnsalias.org/~strombrg/bufsock.html , which abstracts 
> >> >> away these complications, and actually makes things pretty simple.  
> >> >> There are examples on the web page.
> 
> 
> 
> > Thank you very much for the example, the only trouble I'm having now is 
> > installing the bufsock module:
> 
> > wget http://dcs.nac.uci.edu/~strombrg/bufsock.tar.gz
> 
> > results in The requested URL /~strombrg/bufsock.tar.gz was not found on 
> > this server.
> 
> > Could you supply me the necessary installation instructions?
> 
> 
> 
> That's an old link.  It's now at
> 
> http://stromberg.dnsalias.org/~strombrg/bufsock.html
> 
> 
> 
> HTH

I surfed to the new download-link  (http://stromberg.dnsalias.org/svn/bufsock/) 
but I don't see any instructions how to download or install
bufsock.py, I see it has something to do with svn which I don't know how to 
handle. Could you help me with that too?

thanks in advance
jean


http://stromberg.dnsalias.org/svn/bufsock/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Knapsack Problem Without Value

2013-12-13 Thread Ian Kelly
On Thu, Dec 12, 2013 at 7:08 PM,   wrote:
> Hi,
>
> I wanna ask about Knapsack. I do understand what Knapsack is about. But this 
> one i faced is a different problem. There is no value. I mean, it's like 
> this, for example.
>
> I have 4 beams [X0, X1, X2, X3]. Each 1, 2, 2, 3 cm long. I want to make a 
> new 6 cm long connected-beam from these 4 beams. I can make it from some of 
> these. The output will print:
>
> 1, 2, 3 #(X0, X1, X3)
>
> You understand what my problem is? Can you help me?

With no values, where the goal is just to make a specific sum, it's
the subset sum problem, not the knapsack problem.
-- 
https://mail.python.org/mailman/listinfo/python-list


smart splitting - how to

2013-12-13 Thread Helmut Jarausch
Hi,

I'd like to read several strings by using 'input'. 
These strings are separated by white space but I'd like to allow for
some quoting, e.g.

"Guido van" Rossum

should be split into 2 strings only

Now, a simple split doesn't work since it splits the quoted text as well.
Is there a simple way to do so?
It would be nice if it could handle embedded quotes which are escaped 
by a backslash, too.

Is there something simpler then a sophisticated regular expression 
or even a parser?

Many thanks for a hint,
Helmut
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smart splitting - how to

2013-12-13 Thread Chris Angelico
On Fri, Dec 13, 2013 at 10:28 PM, Helmut Jarausch
 wrote:
> Now, a simple split doesn't work since it splits the quoted text as well.
> Is there a simple way to do so?
> It would be nice if it could handle embedded quotes which are escaped
> by a backslash, too.

Sounds like you want shell-style splitting. Check out the shlex module:

http://docs.python.org/3.3/library/shlex.html

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


want to run proxy in python

2013-12-13 Thread Jai
hey , will u guide me how to run proxies from python 

i have tested lots of code but my ip show always constant on when i see it 
online 

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


Re: smart splitting - how to

2013-12-13 Thread Robert Kern

On 2013-12-13 11:28, Helmut Jarausch wrote:

Hi,

I'd like to read several strings by using 'input'.
These strings are separated by white space but I'd like to allow for
some quoting, e.g.

"Guido van" Rossum

should be split into 2 strings only

Now, a simple split doesn't work since it splits the quoted text as well.
Is there a simple way to do so?
It would be nice if it could handle embedded quotes which are escaped
by a backslash, too.

Is there something simpler then a sophisticated regular expression
or even a parser?


http://docs.python.org/3.3/library/shlex


[~]
|1> import shlex

[~]
|2> shlex.split(r'"Guido \"van\" Rossum" invented Python')
['Guido "van" Rossum', 'invented', 'Python']



--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: smart splitting - how to

2013-12-13 Thread Joel Goldstick
On Fri, Dec 13, 2013 at 6:28 AM, Helmut Jarausch <
[email protected]> wrote:

> Hi,
>
> I'd like to read several strings by using 'input'.
> These strings are separated by white space but I'd like to allow for
> some quoting, e.g.
>
> "Guido van" Rossum
>
> should be split into 2 strings only
>
> Now, a simple split doesn't work since it splits the quoted text as well.
> Is there a simple way to do so?
> It would be nice if it could handle embedded quotes which are escaped
> by a backslash, too.
>
> Is there something simpler then a sophisticated regular expression
> or even a parser?
>
> Many thanks for a hint,
> Helmut
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Take a look at the csv reader module.  You can set it to use space as field
separator and also to handle quotes as field delimiters.  This would leave
your quoted strings with spaces as a single field.

http://docs.python.org/2/library/csv.html#dialects-and-formatting-parameters

I haven't tried your example, but I'm pretty sure it can handle it.

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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Jean Dubois
Op vrijdag 13 december 2013 04:32:30 UTC+1 schreef Dan Stromberg:
> On Thu, Dec 12, 2013 at 7:23 PM, Jean Dubois  wrote:
> 
> > Op donderdag 12 december 2013 22:23:22 UTC+1 schreef Dan Stromberg:
> 
> >> On Thu, Dec 12, 2013 at 12:28 AM, Jean Dubois  
> >> wrote:
> 
> >>
> 
> >> > On Thursday, December 12, 2013 12:20:36 AM UTC+1, Dan Stromberg wrote:
> 
> >>
> 
> >> >> On Wed, Dec 11, 2013 at 3:08 PM, Jean Dubois  
> >> >> wrote:
> 
> 
> 
> >> >> For this reason, I wrote 
> >> >> http://stromberg.dnsalias.org/~strombrg/bufsock.html , which abstracts 
> >> >> away these complications, and actually makes things pretty simple.  
> >> >> There are examples on the web page.
> 
> 
> 
> > Thank you very much for the example, the only trouble I'm having now is 
> > installing the bufsock module:
> 
> > wget http://dcs.nac.uci.edu/~strombrg/bufsock.tar.gz
> 
> > results in The requested URL /~strombrg/bufsock.tar.gz was not found on 
> > this server.
> 
> > Could you supply me the necessary installation instructions?
> 
> 
> 
> That's an old link.  It's now at
> 
> http://stromberg.dnsalias.org/~strombrg/bufsock.html
> 
> 
> 
> HTH

I surfed to the new download-link  (http://stromberg.dnsalias.org/svn/bufsock/) 
but I don't see any instructions how to download or install
bufsock.py, I see it has something to do with svn which I don't know how to 
handle. Could you help me with that too?

thanks in advance
jean


http://stromberg.dnsalias.org/svn/bufsock/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smart splitting - how to

2013-12-13 Thread Helmut Jarausch
On Fri, 13 Dec 2013 11:39:57 +, Chris Angelico and Robert Kern wrote:

> On 2013-12-13 11:28, Helmut Jarausch wrote:
>> Hi,
>>
>> I'd like to read several strings by using 'input'.
>> These strings are separated by white space but I'd like to allow for
>> some quoting, e.g.
>>
>> "Guido van" Rossum
>>
>> should be split into 2 strings only
>>
>> Now, a simple split doesn't work since it splits the quoted text as well.
>> Is there a simple way to do so?
>> It would be nice if it could handle embedded quotes which are escaped
>> by a backslash, too.
>>
>> Is there something simpler then a sophisticated regular expression
>> or even a parser?
> 
> http://docs.python.org/3.3/library/shlex
> 
> 
> [~]
> |1> import shlex
> 
> [~]
> |2> shlex.split(r'"Guido \"van\" Rossum" invented Python')
> ['Guido "van" Rossum', 'invented', 'Python']

Many thanks, that works perfectly and is so simple.
Helmut


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


Re: request for guidance

2013-12-13 Thread Ned Batchelder
On Friday, December 13, 2013 12:15:22 AM UTC-5, jennifer stone wrote:
> greetings
> I am a novice who is really interested in contributing to Python projects. 
> How and where do I begin?
> 
> thanking you in anticipation

Jennifer, hi, welcome!  If you are looking for help with the
mechanics of open-source contribution, and with finding projects
and tasks, Open Hatch is a good resource: https://openhatch.org/  

Their entire mission is making it easier for new contributors to 
join open source projects.

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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Jean Dubois
Op vrijdag 13 december 2013 09:35:18 UTC+1 schreef Mark Lawrence:

> Would you please read and action this 
> https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the 
> double line spacing that accompanied the above, thanks.
>
> -- 

>
> Mark Lawrence

Dear Mark,
I'm sorry for the inconvenience my postings may have caused. I now have
followed
the instructions on the link you mentioned and installed the plugin en
python-script.

hope it worked (I saw the text light up yellow when pressing the edit-key a 
second time). A small suggestion from a newbie: it would perhaps be possible
to make the script check itself whether pyhon2 or python3 should be used?

thanks for having patience with me
kind regards,
jean
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request for guidance

2013-12-13 Thread Veritatem Ignotam
I read 'Beginning Python 2.6 and 3.1' by James Payne. It was pretty good.

Code Academy has a python course. http://www.codecademy.com/tracks/python
I've never done it but it might be good

Cheers,

V.I.

On 12/12/2013 11:15 PM, jennifer stone wrote:
> greetings
> I am a novice who is really interested in contributing to Python
> projects. How and where do I begin?
> thanking you in anticipation
>
>

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


Islam is the fastest growing religion in the world especially since sept. 11.

2013-12-13 Thread bv4bv4bv4
Islam is the fastest growing religion in the world especially since sept. 11.

An important article shows that every child is born on the "fitrah" (natural 
inclination) of "Islam", the spread of Islam after September eleventh and that 
it’s necessary to make an open communication between Muslims & Non-Muslims for 
presenting a right picture about Islam .

Salam Alaykum:

Your question about the increase in the "reversion to Islam" is a good one. You 
have given me the excuse to do something that I have wanted to do for a long 
time. I have wanted to write on the subject of "Reverts to Islam in Modern 
Times" and the message that it carries to all of us Muslims about Islam TODAY.
BACK TO Islam?
Reverts to Islam In Modern Times

"Revert" As Opposed to "Convert"

I like to use the word "revert" as opposed to the word "convert" as it more 
suits the occasion of a person returning back to his natural condition at 
birth. The baby is born in true surrender, submission, obedience and peace with 
his Creator. And this is the desirable position of the Muslim, to be in peace 
and submission to the Will of Allah (God in English). Instead of thinking in 
terms of "converting" people over to Islam, it is better understood that they 
are simply returning back to their natural state at birth. And this is from the 
teachings of our beloved prophet, Muhammad, peace be upon him. (Muslims should 
always say "Peace be upon him/them" when referring to any of the prophets).

Like A Baby

Prophet Muhammad, peace be upon him, said: "Every child is born on the "fitrah" 
(natural inclination) of "Islam" (surrender, submission and peace to the 
Creator on His Terms). And it is their parents who raise them up to be Jews, 
Christians or fire worshippers."

Dr. Ted Campbell who is the professor of religion at the seminary school in 
Maryland and I were both sharing the speakers platform last year in Maryland 
University. At the closing of a very nice interfaith dialog there came a 
strange question for both of us. Noah, the moderator said: "This last question 
is for both speakers: "Why are each of you in your religion?"

Dr. Campbell took his position in front of the microphone and then looked 
around the room as he thought about the question. I will never forget his 
words. He said: "I guess I would have to say that I am a Methodist because, 
well because, my parents raised me that way. As a Methodist."

He was right.

That is what we know as Muslims. However, as I mentioned in my answer to the 
same question: "And then some are brought back to their original state as a 
baby." They are "reverted" to Islam by the Mercy of Allah.

Actual or Factual Numbers of American Muslims

Many people are claiming that twice as many, or three times or four times, or 
even ten times as many people are coming into Islam as they did prior to the 
events of September 11. Who could possibly know the numbers? We are not even 
sure how many Muslims live here in America. I have heard the numbers range from 
around 3,000,000 all the way up to 11,000,000. I'm sure that only Allah Knows 
for sure how many Muslims there are in America.

Rate of "Reversion"

Actually, I can't give accurate statistics before or after the September 
events. I have heard from some "experts" that Islam was the fastest growing 
religion in the world prior to the September 11 events. I have no reason to 
doubt it either. In the many Masjids around the United States and in the many 
countries that I have been fortunate enough to visit I have found thousands who 
have entered into Islam. The Anglican Church of England expressed concern that 
if something does not change in the trend of new Muslims in England that the 
Muslims will out number the Anglicans by the year 2010.

The number one name of the birth certificates for new born boys in England was 
not John, or Michael, or William. It is "Muhammad." In Mexico, Sweden, Denmark 
and Canada I have witnessed so many coming into Islam that I cannot count them 
all. Everywhere I go I meet new Muslims. Prisons, universities and even in the 
military I have personally seen thousands who came to Islam. This is all before 
the events of September 11.

More Exposure to the Message

What I feel comfortable saying is that more and more people are being to 
exposed to Islam all over the world. Whether or not the picture they are 
receiving is painted correctly or not is not as important a factor as is the 
fact that at long last many people on this planet are looking at Islam as 
something very real. Therefore, when they ask about Islam some of the 
information is stimulating feelings inside of the people. Naturally we are 
going to see those who are stimulated to be against Islam. At the same time you 
have to understand that there are a number of people who will take the position 
that you cannot always believe everything in the news media. These are the ones 
whom Allah guides to inquire and learn more.

Allah is the Only Guide

It is only 

TypeError: not all arguments converted during string formatting

2013-12-13 Thread Jai
my code :

#!/usr/bin/env python 

from bs4 import BeautifulSoup
import re,urllib2,urlparse, MySQLdb

def get_domain(url):
return urlparse.urlparse(url).netloc


def men_tshirts2(main_link, cat_link,db,cursor):
#print main_link
for cat,link in cat_link.iteritems():
cat = str(cat)
#print cat, link 
page = urllib2.urlopen(link)
soup = BeautifulSoup(page)
page.close()
item = soup.find_all("div",attrs={"class":"itemTitle"})
price = soup.find_all("div", attrs={"class":"itemPrice"})
item_list =[]
price_list =[]
seller_list =[]

for x,y in zip(item,price):
item_content=str(x.a.string)
price = str(y.p.string)
link = str(x.a.get("href"))
page =urllib2.urlopen(link)
soup = BeautifulSoup(page)
page.close()
data = soup.find_all("span", attrs={"class":"mbg-nw"})
seller = str(data[0].string)
#print cat,item_content,price,seller
gender = "men"
sql = """insert into 
fashion(GENDER,links,category,item_content,price,seller) 
VAlUES('%s','%s','%s','%s','%s','s')"""

cursor.execute(sql,(gender,main_link,cat,item_content,price,seller))
db.commit()
#except:
#db.rollback()
#print 
len(gender),len(main_link),len(cat),len(item_content),len(price),len(seller)



def men_tshirts(db,cursor):
main_link = "http://fashion.ebay.in/index.html#men_tshirts";
domane = get_domain(main_link)
main_page = urllib2.urlopen(main_link)
main_soup=BeautifulSoup(main_page)
main_page.close()
data = main_soup.find_all("div",attrs= {"class":"itmTitle"})
price = main_soup.find_all("span",attrs={"class":"catlblTitle"})
cat_link  = {}
for x, y in zip(data, price):
#cat= str(x.a.string)+":"+str(y.string)
cat= str(x.a.string)
link= "http://"+domane+"/"+str(x.a.get("href"))
#print cat, link 
cat_link[cat] = link

men_tshirts2(main_link, cat_link,db,cursor)





if __name__=="__main__":
 db = MySQLdb.connect("localhost","root","india123","ebay_db" )
 cursor = db.cursor()
 men_tshirts(db,cursor)
 db.close()


++

sql structure :-


mysql> describe fashion;
+--+--+--+-+---++
| Field| Type | Null | Key | Default   | Extra  
|
+--+--+--+-+---++
| id   | int(11)  | NO   | PRI | NULL  | auto_increment 
|
| GENDER   | varchar(6)   | YES  | | NULL  |
|
| links| varchar(255) | YES  | | NULL  |
|
| category | varchar(255) | YES  | | NULL  |
|
| item_content | varchar(255) | YES  | | NULL  |
|
| price| varchar(10)  | YES  | | NULL  |
|
| seller   | varchar(20)  | YES  | | NULL  |
|
| created_on   | timestamp| NO   | | CURRENT_TIMESTAMP |
|
+--+--+--+-+---++
8 rows in set (0.00 sec)
+++

error:


query = query % db.literal(args)
TypeError: not all arguments converted during string formatting
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request for guidance

2013-12-13 Thread Zachary Ware
On Thu, Dec 12, 2013 at 11:15 PM, jennifer stone
 wrote:
> greetings
> I am a novice who is really interested in contributing to Python projects.
> How and where do I begin?
> thanking you in anticipation

If you're interested in contributing to Python itself, you can consult
the Python devguide [1] for suggestions on how to get started.  I
would also recommend the core-mentorship mailing list[2][3], which is
a private (archives are only available to members) list where you can
ask any questions you may have.

Welcome! :)

-- 
Zach

[1] http://docs.python.org/devguide/index.html
[2] List info: http://mail.python.org/mailman/listinfo/core-mentorship
[3] Homepage: http://pythonmentors.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: TypeError: not all arguments converted during string formatting

2013-12-13 Thread Ervin Hegedüs
hello,

On Fri, Dec 13, 2013 at 05:18:59AM -0800, Jai wrote:
> sql = """insert into
> fashion(GENDER,links,category,item_content,price,seller) \
> VAlUES('%s','%s','%s','%s','%s','s')"""


may be you miss a "%" sign?

> query = query % db.literal(args)
> TypeError: not all arguments converted during string formatting


cheers:


a.


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


Re: TypeError: not all arguments converted during string formatting

2013-12-13 Thread Peter Otten
Jai wrote:

> my code :

> sql = """insert into
> fashion(GENDER,links,category,item_content,price,seller)
> VAlUES('%s','%s','%s','%s','%s','s')"""
> cursor.execute(sql,(gender,main_link,cat,item_content,price,seller))

This looks very much like your previous mistake

(1) Don't put quotes around the placeholders. They are probably interpreted 
as string literals.

(2) The last placeholder is missing the %
 
> error:
> 
> 
> query = query % db.literal(args)
> TypeError: not all arguments converted during string formatting

Note that we prefer to see complete tracebacks as this usually simplifies 
debugging a lot.

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


Re: accessing a page which request an openID authentication

2013-12-13 Thread Mark Lawrence

On 13/12/2013 10:32, [email protected] wrote:

I have a page that request an openID authentication "google ID" before you are 
able to download any file from it.
this is the website "http://oc.gtisc.gatech.edu:8080/search.cgi?search=sality"; 
and I tried a lot but it dose not seem that the ordinary login using session or requests 
work on this case ? any guidance or help ?



Please show us a code sample that you've tried.  State what you expected 
to happen, what actually happened, your OS and Python version.  If you 
have a traceback cut and paste all of it into your message.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Jean-Michel Pichavant
- Original Message -
> I have an ethernet-rs232 adapter which allows me to connect to a
> measurement instrument by means of netcat on a linux system.
> e.g. entering nc 10.128.59.63 7000
> allows me to enter e.g.
> *IDN?
> after which I get an identification string of the measurement
> instrument back.
> I thought I could accomplish the same using the python module
> "socket"
> and tried out the sample program below which doesn't work however:
> #!/usr/bin/env python
> 
> """
> A simple echo client
> """
> import socket
> host = '10.128.59.63'
> port = 7000
> size = 10
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.connect((host,port))
> s.send('*IDN?')
> data = s.recv(size)
> s.close()
> print 'Received:', data
> 
> Can anyone here tell me how to do it properly?
> thanks in advance
> jean

Such equipment often implements a telnet protocol. Have use try using the 
telnetlib module ?
http://docs.python.org/2/library/telnetlib.html

t = Telnet(host, port)
t.write('*IDN?')
print t.read_until('Whateverprompt')
# you can use read_very_eager also

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need help with file object

2013-12-13 Thread bob gailer

On 12/12/2013 11:29 PM, Unix SA wrote:

...

With above prog I am getting error
TypeError: coercing to Unicode: need sting or buffer, file found

In future please copy and paste the entire traceback. It appears that 
you typed in just one line of it.


In this case the line raising the exception was obvious, but often it is 
not.

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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Grant Edwards
On 2013-12-12, Dan Stromberg  wrote:
> On Thu, Dec 12, 2013 at 6:16 AM, Grant Edwards  
> wrote:
>
>>> Sockets reserve the right to split one socket.send() into multiple
>>> socket.recv()'s on the other end of the communication, or to aggregate
>>> multiple socket.send()'s into a single socket.recv() - pretty much any way
>>> the relevant IP stacks and communications equipment feel like for the sake
>>> of performance or reliability.
>>
>> Just to be pedantic: _TCP_ sockets reserver that right.  UDP sockets
>> do not, and do in fact guarantee that each message is discrete.  [It
>> appears that the OP is undoubtedly using TCP sockets.]
>
> I haven't done a lot of UDP, but are you pretty sure UDP can't at
> least fragment large packets?  What's a router or switch to do if the
> Path MTU isn't large enough for an original packet?
>
> http://www.gamedev.net/topic/343577-fragmented-udp-packets/

You're conflating IP datagrams and Ethernet packets.  The IP stack can
fragment an IP datagram into multiple Ethernet packets which are then
reassembled by the receiving IP stack into a single datagram before
being passed up to the next layer (in this case, UDP).

Did you read the thread you pointed to?  Your question was answerd by
posting #4 in the thread you cited:

   1) Yes, packets will be fragmented at the network layer (IP), but this
  is something you do not have to worry about since the network
  layer will reassemble the fragments before passing them back up
  to the transport layer (UDP). UDP garentees preserved message
  boundaries, so you never have to worry about only receiving a
  packet fragment :~).


A few other references:

http://tools.ietf.org/html/rfc791

 1.1. Motivation

  [...] The internet protocol provides for transmitting blocks of data
  called datagrams from sources to destinations, [...] The internet
  protocol also provides for fragmentation and reassembly of long
  datagrams, if necessary, for transmission through "small packet"
  networks.
  
  [...]  

 1.4 Operation

  [...]
 
  The internet modules use fields in the internet header to fragment
  and reassemble internet datagrams when necessary for transmission
  through "small packet" networks.
  
  [...]

>From http://en.wikipedia.org/wiki/IP_fragmentation  

  If a receiving host receives a fragmented IP packet, it has to
  reassemble the datagram and pass it to the higher protocol layer.
  Reassembly is intended to happen in the receiving host but in
  practice it may be done by an intermediate router, for example,
  network address translation may need to re-assemble fragments in
  order to translate data streams, e.g. the FTP control protocol, as
  described in RFC 2993
  
-- 
Grant Edwards   grant.b.edwardsYow! I'm continually AMAZED
  at   at th'breathtaking effects
  gmail.comof WIND EROSION!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Grant Edwards
On 2013-12-12, Chris Angelico  wrote:

> Now, if you want reliability AND datagrams, it's a lot easier to add
> boundaries to a TCP stream (sentinel or length prefixes) than to add
> reliability to UDP...

It's unfortunate that there's no standardized reliable
connection-oriented datagram protocol.  The linux kernel implements 
one for Unix domain sockets (SOCK_SEQPACKET), and its really, really
useful.

Adding boundaries to a TCP stream achieves the same goal (and isn't
that hard to do), but since there's no standard for it, people keep
having to reinvent it (often badly and always incompaibly).

-- 
Grant Edwards   grant.b.edwardsYow! Hello...  IRON
  at   CURTAIN?  Send over a
  gmail.comSAUSAGE PIZZA!  World War
   III?  No thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread wxjmfauth
Le jeudi 12 décembre 2013 18:55:15 UTC+1, Terry Reedy a écrit :
> 
> 
> 
> 
> 
> If you mean cp65xxx (I forget exact numbers), MS Command Prompt fails, 
> 
> not Python. One should not use any other code page, but only other code 
> 
> pages work.
> 
> 
> 

-

Please, do not exaggerate too much.
On my win7 box, using cp65001:

The golang works. Despite my poor knowledge with with
this language, I even relatively quickly succeded to write
a "readline" fct.

Ruby 2 works.

irb, the interactive ruby works. I remember to have had
some diffuculties in entering some chars, this a different
problem.

echo "unicode" works.

xelatex (my favourite tool), a tex-unicode engine, works.
I'm usualy using a GUI tool, I just tested with a "éàü.tex"
document. Indeed, it works.

Starting that created document "éàü.pdf" with the cmd
> start éàü.pdf
works. It calls Acrobat Reader.

Starting that created document with Sumatra, a pdf viewer
works.

Not directly related to my comment, I can compile a
.tex document in such a dir
> D:\jm\Москва\Zürich\Αθήνα\œdipe
and it works.

Something a little bit different. Neil Hodgson's SciTE
editor. One can configure the output pane to use 65001.
All the examples above works. It is also possible to 
make Python working, but I had to write my own "printing
material".

A note about font. The console does not, and is not able,
to display all the "chars". It is however always displaying
text very smoothly and correctly using the replacement *glyph".
Nothing to do with an "incorrect behaviour" of the console.

Eg:
> echo "ሴé€㑖Ѓ⌴*"
works.

I mainly considered BMP "characters".

Windows is not so bad. One can discuss ad nauseam
the pros and cons of console-gui application. I have
always considered Windows as a system which use gui
applications. And even with Python using a gui toolkit,
I sometimes "link" my own created "gui console".

I do not wish to defend MS. What I wrote depends
on the Windows version, XP, Vista, Windows 7. 
One should recognize, with win7, MS, finally, produce
a full unicode system. Strangely, among all the "bashing"
one can read about that system, this is rarely mentioned.
(With an excellent unicode coding scheme!)

jmf



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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 3:10 AM, Grant Edwards  wrote:
> Adding boundaries to a TCP stream achieves the same goal (and isn't
> that hard to do), but since there's no standard for it, people keep
> having to reinvent it (often badly and always incompaibly).

Nearest to a standard would be the way heaps of internet protocols are
line-based - SMTP, POP, IMAP, FTP, and to a lesser extent HTTP as
well. The end-of-line sequence \r\n delimits messages.

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Frank Miles
On Thu, 12 Dec 2013 16:18:22 -0500, Larry Martell wrote:

> On Thu, Dec 12, 2013 at 11:51 AM, bob gailer  wrote:
>> On 12/11/2013 9:07 PM, Larry Martell wrote:
>>
>>> Nope. Long before that I was working on computers that didn't boot when
>>> you powered them up, You had to manually key in a bootstrap program from the
>>> front panel switches.
>>
>> PDP8? RIM loader, BIN loader?
> 
> Data General Nova 3

IIRC - wasn't that a machine that didn't even have 'subtract' - you had
to complement and add (2 steps) ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 3:15 AM,   wrote:
> One should recognize, with win7, MS, finally, produce
> a full unicode system. Strangely, among all the "bashing"
> one can read about that system, this is rarely mentioned.
> (With an excellent unicode coding scheme!)

[citation needed]

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


Re: Islam is the fastest growing religion in the world especially since sept. 11.

2013-12-13 Thread Amirouche Boubekki
Why is [email protected] still not banned?


2013/12/13 

> Islam is the fastest growing religion in the world especially since sept.
> 11.
>
> An important article shows that every child is born on the "fitrah"
> (natural inclination) of "Islam", the spread of Islam after September
> eleventh and that it’s necessary to make an open communication between
> Muslims & Non-Muslims for presenting a right picture about Islam .
>
> Salam Alaykum:
>
> Your question about the increase in the "reversion to Islam" is a good
> one. You have given me the excuse to do something that I have wanted to do
> for a long time. I have wanted to write on the subject of "Reverts to Islam
> in Modern Times" and the message that it carries to all of us Muslims about
> Islam TODAY.
> BACK TO Islam?
> Reverts to Islam In Modern Times
>
> "Revert" As Opposed to "Convert"
>
> I like to use the word "revert" as opposed to the word "convert" as it
> more suits the occasion of a person returning back to his natural condition
> at birth. The baby is born in true surrender, submission, obedience and
> peace with his Creator. And this is the desirable position of the Muslim,
> to be in peace and submission to the Will of Allah (God in English).
> Instead of thinking in terms of "converting" people over to Islam, it is
> better understood that they are simply returning back to their natural
> state at birth. And this is from the teachings of our beloved prophet,
> Muhammad, peace be upon him. (Muslims should always say "Peace be upon
> him/them" when referring to any of the prophets).
>
> Like A Baby
>
> Prophet Muhammad, peace be upon him, said: "Every child is born on the
> "fitrah" (natural inclination) of "Islam" (surrender, submission and peace
> to the Creator on His Terms). And it is their parents who raise them up to
> be Jews, Christians or fire worshippers."
>
> Dr. Ted Campbell who is the professor of religion at the seminary school
> in Maryland and I were both sharing the speakers platform last year in
> Maryland University. At the closing of a very nice interfaith dialog there
> came a strange question for both of us. Noah, the moderator said: "This
> last question is for both speakers: "Why are each of you in your religion?"
>
> Dr. Campbell took his position in front of the microphone and then looked
> around the room as he thought about the question. I will never forget his
> words. He said: "I guess I would have to say that I am a Methodist because,
> well because, my parents raised me that way. As a Methodist."
>
> He was right.
>
> That is what we know as Muslims. However, as I mentioned in my answer to
> the same question: "And then some are brought back to their original state
> as a baby." They are "reverted" to Islam by the Mercy of Allah.
>
> Actual or Factual Numbers of American Muslims
>
> Many people are claiming that twice as many, or three times or four times,
> or even ten times as many people are coming into Islam as they did prior to
> the events of September 11. Who could possibly know the numbers? We are not
> even sure how many Muslims live here in America. I have heard the numbers
> range from around 3,000,000 all the way up to 11,000,000. I'm sure that
> only Allah Knows for sure how many Muslims there are in America.
>
> Rate of "Reversion"
>
> Actually, I can't give accurate statistics before or after the September
> events. I have heard from some "experts" that Islam was the fastest growing
> religion in the world prior to the September 11 events. I have no reason to
> doubt it either. In the many Masjids around the United States and in the
> many countries that I have been fortunate enough to visit I have found
> thousands who have entered into Islam. The Anglican Church of England
> expressed concern that if something does not change in the trend of new
> Muslims in England that the Muslims will out number the Anglicans by the
> year 2010.
>
> The number one name of the birth certificates for new born boys in England
> was not John, or Michael, or William. It is "Muhammad." In Mexico, Sweden,
> Denmark and Canada I have witnessed so many coming into Islam that I cannot
> count them all. Everywhere I go I meet new Muslims. Prisons, universities
> and even in the military I have personally seen thousands who came to
> Islam. This is all before the events of September 11.
>
> More Exposure to the Message
>
> What I feel comfortable saying is that more and more people are being to
> exposed to Islam all over the world. Whether or not the picture they are
> receiving is painted correctly or not is not as important a factor as is
> the fact that at long last many people on this planet are looking at Islam
> as something very real. Therefore, when they ask about Islam some of the
> information is stimulating feelings inside of the people. Naturally we are
> going to see those who are stimulated to be against Islam. At the same time
> you have to understand that there are a number of people who will take

Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Mark Lawrence

On 13/12/2013 16:27, Chris Angelico wrote:

On Sat, Dec 14, 2013 at 3:15 AM,   wrote:

One should recognize, with win7, MS, finally, produce
a full unicode system. Strangely, among all the "bashing"
one can read about that system, this is rarely mentioned.
(With an excellent unicode coding scheme!)


[citation needed]

ChrisA



You'll have to wait until the cows come home on two counts.  One, he's 
never yet provided any evidence to support any statement that he's ever 
made here.  Second, he's still not smart enough to stop sending double 
spaced google crap.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: Using pythons smtp server

2013-12-13 Thread Grant Edwards
On 2013-12-13, Vincent Davis  wrote:

> I have an app that generates a file one a day and would like to email it
> using pythons SMTP server.

You don't send mail using an SMTP server.  You receive mail using an
SMTP server.

> http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
> The documentation is kinda sparse and I cant seem to find any good examples.
>
> Basically what I want to do; when my app runs it would initiate a SMTP
> server, send the attachment and shutdown the SMTP after.

Newsgroups: comp.lang.python
From: Grant Edwards 
Subject: Re: Using pythons smtp server
References: 
Followup-To:

On 2013-12-13, Vincent Davis  wrote:

> I have an app that generates a file one a day and would like to email
> it using pythons SMTP server.

You don't send mail using an SMTP server.  You receive mail using an 
SMTP server.  You send mail using an SMTP client.

> http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
> The documentation is kinda sparse and I cant seem to find any good examples.
>
> Basically what I want to do; when my app runs it would initiate a SMTP
> server, send the attachment and shutdown the SMTP after.

https://www.google.com/search?q=python+send+email+smtp

-- 
Grant Edwards   grant.b.edwardsYow! The PINK SOCKS were
  at   ORIGINALLY from 1952!!
  gmail.comBut they went to MARS
   around 1953!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Islam is the fastest growing religion in the world especially since sept. 11.

2013-12-13 Thread Tim Golden
On 13/12/2013 16:32, Amirouche Boubekki wrote:
> Why is [email protected]  still not banned?

[... snip long spiel from bv4 etc. ...]

Before recently, the answer would have been: because they're coming in
through the Usenet gateway so there's no mailing list subscription to
suspend.

However, we've recently implemented filtering via the gateway, and I've
just added bv4 to the list of banned addresses. (I'm not 100% sure I've
got it right, so let's see if they make it in again).

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


Re: Islam is the fastest growing religion in the world especially since sept. 11.

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 3:32 AM, Amirouche Boubekki
 wrote:
> Why is [email protected] still not banned?
>
>
> 2013/12/13 
>> [ a whole lot of quoted text, including the URL ]

Why do you quote all the text, including the web link? I didn't see
the original, thanks to good spam filtering, but your response brought
this to my attention, not to mention put another copy into the
archives. Please, just ignore these sorts of things; or if you want to
reply for whatever reason, trim out the content, especially any links.

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


Re: accessing a page which request an openID authentication

2013-12-13 Thread Denis McMahon
On Fri, 13 Dec 2013 02:32:49 -0800, uni.mail.2014 wrote:

> I have a page that request an openID authentication 

And your Python question is?

-- 
Denis McMahon, [email protected]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request for guidance

2013-12-13 Thread rusi
On Friday, December 13, 2013 10:45:22 AM UTC+5:30, jennifer stone wrote:
> greetings

> I am a novice who is really interested in contributing to Python
> projects. How and where do I begin?

Good to see new names!

How much python do you know/studied/coded?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: want to run proxy in python

2013-12-13 Thread Denis McMahon
On Fri, 13 Dec 2013 03:39:44 -0800, Jai wrote:

> hey , will u guide me how to run proxies from python

http://lmgtfy.com/?q=ip+address+spoofing

-- 
Denis McMahon, [email protected]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 3:39 AM, Mark Lawrence  wrote:
> On 13/12/2013 16:27, Chris Angelico wrote:
>>
>> On Sat, Dec 14, 2013 at 3:15 AM,   wrote:
>>>
>>> One should recognize, with win7, MS, finally, produce
>>> a full unicode system. Strangely, among all the "bashing"
>>> one can read about that system, this is rarely mentioned.
>>> (With an excellent unicode coding scheme!)
>>
>>
>> [citation needed]
>>
>> ChrisA
>>
>
> You'll have to wait until the cows come home on two counts.  One, he's never
> yet provided any evidence to support any statement that he's ever made here.
> Second, he's still not smart enough to stop sending double spaced google
> crap.

I don't know that it's a matter of not being smart enough. It's just
as likely to be a deliberate choice, as that method of posting ensures
that the quality of the style matches the quality of the substance.

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread rusi
On Friday, December 13, 2013 10:13:11 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Dec 14, 2013 at 3:39 AM, Mark Lawrence  wrote:
> > You'll have to wait until the cows come home on two counts.  One, he's never
> > yet provided any evidence to support any statement that he's ever made here.
> > Second, he's still not smart enough to stop sending double spaced google
> > crap.

> I don't know that it's a matter of not being smart enough. It's just
> as likely to be a deliberate choice, as that method of posting ensures
> that the quality of the style matches the quality of the substance.

Correlates? Ok
Ensures??   Citation needed
-- 
https://mail.python.org/mailman/listinfo/python-list


Filtering and blocking (was Re: Islam is the spammiest subject line on python-list)

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 3:40 AM, Tim Golden  wrote:
> However, we've recently implemented filtering via the gateway, and I've
> just added bv4 to the list of banned addresses. (I'm not 100% sure I've
> got it right, so let's see if they make it in again).

What happens if someone else trips the filter (collateral damage)? Are
they informed that they're blocked, or does the post get black-holed?

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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Grant Edwards
On 2013-12-13, Chris Angelico  wrote:
> On Sat, Dec 14, 2013 at 3:10 AM, Grant Edwards  
> wrote:
>> Adding boundaries to a TCP stream achieves the same goal (and isn't
>> that hard to do), but since there's no standard for it, people keep
>> having to reinvent it (often badly and always incompaibly).
>
> Nearest to a standard would be the way heaps of internet protocols are
> line-based - SMTP, POP, IMAP, FTP, and to a lesser extent HTTP as
> well. The end-of-line sequence \r\n delimits messages.

And that works very nicely for things that transport text.  It's easy
to implement, easy to debug, easy to test.  But, when you need to
transport binary data, it gets ugly and compatibility problems start
to arise pretty quickly.

One could also borrow standards from the old-school serial world and
us the SYN/STX/ETX framing with byte stuffing used by HDLC et al.

-- 
Grant Edwards   grant.b.edwardsYow! My vaseline is
  at   RUNNING...
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Mark Lawrence

On 13/12/2013 16:43, Chris Angelico wrote:

On Sat, Dec 14, 2013 at 3:39 AM, Mark Lawrence  wrote:

On 13/12/2013 16:27, Chris Angelico wrote:


On Sat, Dec 14, 2013 at 3:15 AM,   wrote:


One should recognize, with win7, MS, finally, produce
a full unicode system. Strangely, among all the "bashing"
one can read about that system, this is rarely mentioned.
(With an excellent unicode coding scheme!)



[citation needed]

ChrisA



You'll have to wait until the cows come home on two counts.  One, he's never
yet provided any evidence to support any statement that he's ever made here.
Second, he's still not smart enough to stop sending double spaced google
crap.


I don't know that it's a matter of not being smart enough. It's just
as likely to be a deliberate choice, as that method of posting ensures
that the quality of the style matches the quality of the substance.

ChrisA



How can it be deliberate choice, that implies thought in the first 
place, which is highly conspicious by its absence?


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread rusi
On Friday, December 13, 2013 5:50:03 PM UTC+5:30, Jean Dubois wrote:
> Op vrijdag 13 december 2013 09:35:18 UTC+1 schreef Mark Lawrence:

> > Would you please read and action this 
> > https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing the 
> > double line spacing that accompanied the above, thanks.
> > -- 

> > Mark Lawrence

> Dear Mark,
> I'm sorry for the inconvenience my postings may have caused. I now have
> followed
> the instructions on the link you mentioned and installed the plugin en
> python-script.

Thanks for cooperating

> hope it worked (I saw the text light up yellow when pressing the edit-key a 
> second time). A small suggestion from a newbie: it would perhaps be possible
> to make the script check itself whether pyhon2 or python3 should be used?

Yes... Half way
The double-spacing problem is cured
However the long-lines remain (see your "hope it worked..." above)
Did you click the edit button both before and after your typing?

The 'before' should remove the double-spaced (old >...) lines
The 'after' should even out the right margins of what you've just typed

> thanks for having patience with me

Yes and you too please bear with us as we iron out this little irritant niggle

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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 3:57 AM, Grant Edwards  wrote:
> On 2013-12-13, Chris Angelico  wrote:
>> On Sat, Dec 14, 2013 at 3:10 AM, Grant Edwards  
>> wrote:
>>> Adding boundaries to a TCP stream achieves the same goal (and isn't
>>> that hard to do), but since there's no standard for it, people keep
>>> having to reinvent it (often badly and always incompaibly).
>>
>> Nearest to a standard would be the way heaps of internet protocols are
>> line-based - SMTP, POP, IMAP, FTP, and to a lesser extent HTTP as
>> well. The end-of-line sequence \r\n delimits messages.
>
> And that works very nicely for things that transport text.  It's easy
> to implement, easy to debug, easy to test.  But, when you need to
> transport binary data, it gets ugly and compatibility problems start
> to arise pretty quickly.
>
> One could also borrow standards from the old-school serial world and
> us the SYN/STX/ETX framing with byte stuffing used by HDLC et al.

Yeah, or if it's a tight binary protocol with occasional bits of
bigger payload, either MIDI or TELNET could offer ideas. MIDI's SysEx
message can carry whatever is needed of it, and TELNET has
subnegotiation that can be used for the odd thingy or so. But for a
generic binary stream-of-messages pipe (as opposed to the
stream-of-bytes pipe that TCP normally offers), probably the easiest
is to precede each write with an N-byte length... and somehow
negotiate what N should be. (And endianness, but hopefully that's just
network byte order.)

Standards are awesome, there are so many to choose from! http://xkcd.com/927/

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


Re: [newbie] trying socket as a replacement for nc

2013-12-13 Thread rusi
On Friday, December 13, 2013 5:50:03 PM UTC+5:30, Jean Dubois wrote:
> to make the script check itself whether pyhon2 or python3 should be used?

As far as I know both (2 and 3) worked
Do you have some reason to suspect one works and other not?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 3:54 AM, rusi  wrote:
>> I don't know that it's a matter of not being smart enough. It's just
>> as likely to be a deliberate choice, as that method of posting ensures
>> that the quality of the style matches the quality of the substance.
>
> Correlates? Ok
> Ensures??   Citation needed

For jmf's posts? Definitely ensures. Citation: python-list archives. :)

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


Re: Islam is the fastest growing religion in the world especially since sept. 11.

2013-12-13 Thread Chris “Kwpolska” Warrick
On Fri, Dec 13, 2013 at 5:32 PM, Amirouche Boubekki
 wrote:
> Why is [email protected] still not banned?

Because they’re posting via Usenet.  Google Groups, to be exact — if
someone feels like it, go bug .

> 2013/12/13 
>
>> Islam is the fastest growing religion in the world especially since sept.
>> 11.
>>
>> An important article shows that every child is born on the "fitrah"
>> (natural inclination) of "Islam", the spread of Islam after September
>> eleventh and that it’s necessary to make an open communication between
>> Muslims & Non-Muslims for presenting a right picture about Islam .
>>
>> Salam Alaykum:
>>
>> Your question about the increase in the "reversion to Islam" is a good
>> one. You have given me the excuse to do something that I have wanted to do
>> for a long time. I have wanted to write on the subject of "Reverts to Islam
>> in Modern Times" and the message that it carries to all of us Muslims about
>> Islam TODAY.
>> BACK TO Islam?
>> Reverts to Islam In Modern Times
>>
>> "Revert" As Opposed to "Convert"
>>
>> I like to use the word "revert" as opposed to the word "convert" as it
>> more suits the occasion of a person returning back to his natural condition
>> at birth. The baby is born in true surrender, submission, obedience and
>> peace with his Creator. And this is the desirable position of the Muslim, to
>> be in peace and submission to the Will of Allah (God in English). Instead of
>> thinking in terms of "converting" people over to Islam, it is better
>> understood that they are simply returning back to their natural state at
>> birth. And this is from the teachings of our beloved prophet, Muhammad,
>> peace be upon him. (Muslims should always say "Peace be upon him/them" when
>> referring to any of the prophets).
>>
>> Like A Baby
>>
>> Prophet Muhammad, peace be upon him, said: "Every child is born on the
>> "fitrah" (natural inclination) of "Islam" (surrender, submission and peace
>> to the Creator on His Terms). And it is their parents who raise them up to
>> be Jews, Christians or fire worshippers."
>>
>> Dr. Ted Campbell who is the professor of religion at the seminary school
>> in Maryland and I were both sharing the speakers platform last year in
>> Maryland University. At the closing of a very nice interfaith dialog there
>> came a strange question for both of us. Noah, the moderator said: "This last
>> question is for both speakers: "Why are each of you in your religion?"
>>
>> Dr. Campbell took his position in front of the microphone and then looked
>> around the room as he thought about the question. I will never forget his
>> words. He said: "I guess I would have to say that I am a Methodist because,
>> well because, my parents raised me that way. As a Methodist."
>>
>> He was right.
>>
>> That is what we know as Muslims. However, as I mentioned in my answer to
>> the same question: "And then some are brought back to their original state
>> as a baby." They are "reverted" to Islam by the Mercy of Allah.
>>
>> Actual or Factual Numbers of American Muslims
>>
>> Many people are claiming that twice as many, or three times or four times,
>> or even ten times as many people are coming into Islam as they did prior to
>> the events of September 11. Who could possibly know the numbers? We are not
>> even sure how many Muslims live here in America. I have heard the numbers
>> range from around 3,000,000 all the way up to 11,000,000. I'm sure that only
>> Allah Knows for sure how many Muslims there are in America.
>>
>> Rate of "Reversion"
>>
>> Actually, I can't give accurate statistics before or after the September
>> events. I have heard from some "experts" that Islam was the fastest growing
>> religion in the world prior to the September 11 events. I have no reason to
>> doubt it either. In the many Masjids around the United States and in the
>> many countries that I have been fortunate enough to visit I have found
>> thousands who have entered into Islam. The Anglican Church of England
>> expressed concern that if something does not change in the trend of new
>> Muslims in England that the Muslims will out number the Anglicans by the
>> year 2010.
>>
>> The number one name of the birth certificates for new born boys in England
>> was not John, or Michael, or William. It is "Muhammad." In Mexico, Sweden,
>> Denmark and Canada I have witnessed so many coming into Islam that I cannot
>> count them all. Everywhere I go I meet new Muslims. Prisons, universities
>> and even in the military I have personally seen thousands who came to Islam.
>> This is all before the events of September 11.
>>
>> More Exposure to the Message
>>
>> What I feel comfortable saying is that more and more people are being to
>> exposed to Islam all over the world. Whether or not the picture they are
>> receiving is painted correctly or not is not as important a factor as is the
>> fact that at long last many people on this planet are looking at Islam as
>> something very real. Therefore, when they

Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis
>
> "You don't send mail using an SMTP server.  You receive mail using an
> SMTP server.
> ​"​
>

Um maybe, I guess it is a matter of perspective.

Let me rephrase my question. ​​I want to send an email using python but do
not want to use an external service. Does python have the ability to send
emails without installing additional software or using an external
server/service?
Maybe I am wrong, I thought examples like s = smtplib.SMTP('localhost')
​​ are using a local(outside of python) smtp server, like postfix.




Vincent Davis
720-301-3003


On Fri, Dec 13, 2013 at 9:40 AM, Grant Edwards wrote:

> On 2013-12-13, Vincent Davis  wrote:
>
> > I have an app that generates a file one a day and would like to email it
> > using pythons SMTP server.
>
> You don't send mail using an SMTP server.  You receive mail using an
> SMTP server.
>
> > http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
> > The documentation is kinda sparse and I cant seem to find any good
> examples.
> >
> > Basically what I want to do; when my app runs it would initiate a SMTP
> > server, send the attachment and shutdown the SMTP after.
>
> Newsgroups: comp.lang.python
> From: Grant Edwards 
> Subject: Re: Using pythons smtp server
> References: 
> Followup-To:
>
> On 2013-12-13, Vincent Davis  wrote:
>
> > I have an app that generates a file one a day and would like to email
> > it using pythons SMTP server.
>
> You don't send mail using an SMTP server.  You receive mail using an
> SMTP server.  You send mail using an SMTP client.
>
> > http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
> > The documentation is kinda sparse and I cant seem to find any good
> examples.
> >
> > Basically what I want to do; when my app runs it would initiate a SMTP
> > server, send the attachment and shutdown the SMTP after.
>
> https://www.google.com/search?q=python+send+email+smtp
>
> --
> Grant Edwards   grant.b.edwardsYow! The PINK SOCKS were
>   at   ORIGINALLY from 1952!!
>   gmail.comBut they went to MARS
>around 1953!!
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis
Obviously I don't really know how this works. I have used python to send
email using "my" smtp server (whatever that may be gmail, postfix..)
But I don't want to do that. After a little more research I think what I
need to do is lookup the MX address of the address I want to send the email
too.
Then submit the email to that address using smtplib.SMTP
​Do I have that right?
​


Vincent Davis
720-301-3003


On Fri, Dec 13, 2013 at 10:24 AM, Dennis Lee Bieber
wrote:

> On Thu, 12 Dec 2013 18:01:58 -0700, Vincent Davis
>  declaimed the following:
>
> >I have an app that generates a file one a day and would like to email it
> >using pythons SMTP server.
> >http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
> >The documentation is kinda sparse and I cant seem to find any good
> examples.
> >
> >Basically what I want to do; when my app runs it would initiate a SMTP
> >server, send the attachment and shutdown the SMTP after.
> >
>
> I suspect you don't want the "server" per se -- that's more a unit
> for
> receiving SMTP mail (sure, you can start it, but then you have to send the
> email to IT so it can relay it to the next server in the line).
>
> Look into the smtplib module (section 20.12 in the v2.7.2
> documentation) in order to send email TO a mail server
> --
> Wulfraed Dennis Lee Bieber AF6VN
> [email protected]://wlfraed.home.netcom.com/
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request for guidance

2013-12-13 Thread jennifer stone
hello!
thanks a ton for your warm response. I know the basics of python with some
modules like pickle, urllib, re. Its kind of basic I know. but it gotta
start somewhere and I really want to have real world experience.
thanks
jennifer


On Fri, Dec 13, 2013 at 10:45 AM, jennifer stone
wrote:

> greetings
> I am a novice who is really interested in contributing to Python projects.
> How and where do I begin?
> thanking you in anticipation
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: min max from tuples in list

2013-12-13 Thread rusi
On Friday, December 13, 2013 11:58:51 AM UTC+5:30, Robert Voigtländer wrote:
> >I've heard the term used often.  It means something like, "performs 
> >well" or "runs fast".  It may or may not be an English word, but that 
> >doesn't stop people from using it :-) 

> > If "google" can be used to mean "make huge amouts of money with a 
> > product that is inherently flawed" then I'll happily accept "performant" 
> > as an English word, regardless of whether the English variant is UK, US, 
> > Australian, New Zealand, Soth African, Geordie, Glaswegian or any other :)

> Indeed it's not an english word. I have to stop using it. In German
> it's used with the meaning of "runs fast". Even though it's already
> not that clearly defined there.

> Thanks for the help on the topic of data aggregation. It helped a
> lot and I again learned somthing.  I have a performant .. well
> .. fast running solution now.

Well "performant" is performant enough for the purposes of communicating
on the python list I think :D
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Grant Edwards
On 2013-12-13, Vincent Davis  wrote:

> Obviously I don't really know how this works. I have used python to
> send email using "my" smtp server (whatever that may be gmail,
> postfix..) But I don't want to do that. After a little more research
> I think what I need to do is lookup the MX address of the address I
> want to send the email too.
>
> Then submit the email to that address using smtplib.SMTP

Maybe.  In theory, that will work -- and it did in the good old days
before SPAM (the electric kind) was invented.

But, many SMTP servers (the ones pointed to by the MX record) will not
accept mail from you unless you meet various requirements (which vary
considerably and the SMTP servers administrators try to keep secret).

For example you may have to be sending from an IP address who's
reverse-DNS lookup matches up with the from headers and with the MX
record for the domain you claim to be sending from.

Your mail might also get blocked/discarded if you're sending from
what's been identified as a dynamically allocated IP block (even if it
does have proper DNS and MX records).

-- 
Grant Edwards   grant.b.edwardsYow! Look into my eyes and
  at   try to forget that you have
  gmail.coma Macy's charge card!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 4:13 AM, Vincent Davis  wrote:
> Let me rephrase my question. I want to send an email using python but do not
> want to use an external service. Does python have the ability to send emails
> without installing additional software or using an external server/service?

Any SMTP server you install has to do one of three things with the
mail you give it:

1) Accept it locally. Presumably the wrong thing to do here.
2) Deliver it to the authoritative SMTP server for the domain.
3) Deliver it to an intermediate server.

(Edit: Your next mail shows that you understand that, as looking up
the MX record is what I was going to say here.)

So if you want to avoid using an external intermediate server, you
need to find and talk to the authoritative server. Now, this is where
another big consideration comes in. What envelope From address are you
going to use? Is your own IP address allowed to send mail for that
domain? If not, you may be forced to use the legitimate server for
that domain. There are other concerns, too; if you don't have a nice
name to announce in the HELO, you might find your mail treated as
spam. But if you deal with all that, then yes, the only thing you need
to do is look up the MX record and pick the best server. (And then
deal with other concerns like coping with that one being down, which
is the advantage of having a local mail queue. But sometimes that
doesn't matter, like if you're sending to yourself for notifications.)

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


Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis
Grant, Chris
Thanks !!!
I guess in the end this is a bad idea, (for my purposes) I should just use
my gmail account smtp server.

Vincent Davis
720-301-3003


On Fri, Dec 13, 2013 at 11:15 AM, Chris Angelico  wrote:

> On Sat, Dec 14, 2013 at 4:13 AM, Vincent Davis 
> wrote:
> > Let me rephrase my question. I want to send an email using python but do
> not
> > want to use an external service. Does python have the ability to send
> emails
> > without installing additional software or using an external
> server/service?
>
> Any SMTP server you install has to do one of three things with the
> mail you give it:
>
> 1) Accept it locally. Presumably the wrong thing to do here.
> 2) Deliver it to the authoritative SMTP server for the domain.
> 3) Deliver it to an intermediate server.
>
> (Edit: Your next mail shows that you understand that, as looking up
> the MX record is what I was going to say here.)
>
> So if you want to avoid using an external intermediate server, you
> need to find and talk to the authoritative server. Now, this is where
> another big consideration comes in. What envelope From address are you
> going to use? Is your own IP address allowed to send mail for that
> domain? If not, you may be forced to use the legitimate server for
> that domain. There are other concerns, too; if you don't have a nice
> name to announce in the HELO, you might find your mail treated as
> spam. But if you deal with all that, then yes, the only thing you need
> to do is look up the MX record and pick the best server. (And then
> deal with other concerns like coping with that one being down, which
> is the advantage of having a local mail queue. But sometimes that
> doesn't matter, like if you're sending to yourself for notifications.)
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread wxjmfauth
Le vendredi 13 décembre 2013 17:27:35 UTC+1, Chris Angelico a écrit :
> On Sat, Dec 14, 2013 at 3:15 AM,   wrote:
> 
> > One should recognize, with win7, MS, finally, produce
> 
> > a full unicode system. Strangely, among all the "bashing"
> 
> > one can read about that system, this is rarely mentioned.
> 
> > (With an excellent unicode coding scheme!)
> 
> 
> 
> [citation needed]
> 
-

My guess is that you are referring to that
sentence "(With an excellent unicode coding scheme!)".
I do not need to cite anything. That's my opinion.

My comment was mainly oriented about cp65*** in the
context of a teaching programming language. I pointed
that some tools are working very well with that code
page.

jmf

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


Re: Using pythons smtp server

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 5:27 AM, Vincent Davis  wrote:
> Grant, Chris
> Thanks !!!
> I guess in the end this is a bad idea, (for my purposes) I should just use
> my gmail account smtp server.

If you're sending from gmail, use whatever gmail specifies for
sending. Otherwise your mail will be seen as spoofed.

The converse of this is that, in my opinion, *every* domain should
have an SPF record and *every* mail server should check them. That
would eliminate a huge slab of forged mail, and it'd prevent some
stupid web email forms from doing the wrong thing and only finding out
that it's wrong years later.

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 5:27 AM,   wrote:
> My guess is that you are referring to that
> sentence "(With an excellent unicode coding scheme!)".
> I do not need to cite anything. That's my opinion.

Just as much to what's above it, where you state that MS has produced
"a full unicode system". Is that, too, just opinion, utterly unfounded
in fact, or can you provide a citation?

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread wxjmfauth
Le vendredi 13 décembre 2013 19:32:58 UTC+1, Chris Angelico a écrit :
> On Sat, Dec 14, 2013 at 5:27 AM,   wrote:
> 
> > My guess is that you are referring to that
> 
> > sentence "(With an excellent unicode coding scheme!)".
> 
> > I do not need to cite anything. That's my opinion.
> 
> 
> 
> Just as much to what's above it, where you state that MS has produced
> 
> "a full unicode system". Is that, too, just opinion, utterly unfounded
> 
> in fact, or can you provide a citation?
> 
> 

I have not the knowledge to put a jugment on this. 
I read many articles on the subject from people
who seems to have some skills on the subject.

>From my own experience with my limited and empirical
computing experience, when I see the file system,
the rendering engine, the usage of OpenType fonts, ...
I tend to have to agree. I can also point that all
these aspects jump to my mind when I switched from
XP to 7. Some time ago, I even fall on an article
about the bootstraping mechanism (7 or 8 or future
version or RT ?) which uses natively ucs-2.

jmf


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


Re: Using pythons smtp server

2013-12-13 Thread Grant Edwards
On 2013-12-13, Vincent Davis  wrote:
> Grant, Chris
> Thanks !!!

> I guess in the end this is a bad idea, (for my purposes) I should just use
> my gmail account smtp server.

If you're going to claim the mail is from @gmail.com, then
yes you should definitly send it via Gmail's SMTP server.  Doing
anything else is going to be a long, losing battle involving you
learning more about SMTP and e-mail headers than you probably want to.

If you've got your own domain (which you're using as the "from"
address), a static IP, and your own MX record and corresponding SMTP
server, you should be able to set things up to send mail directly.

Many years ago (like 20), I used to configure my home Linux boxes to
send mail directly to the destination SMTP server while claiming to be
from "[email protected]".  At first it worked fine that way.
Then about about 12-15 years ago, I started having problems with some
servers refusing my mail.  I had a static IP address with a real,
official hostname, so I set up an MX record for that hostname, and
made sure my handshaking configuration was using a hostname that
mapped back to my static IP address.  That helped for a while, but
SMTP servers continued to get more and more paranoid.  Some SMTP
servers won't accept mail from an IP if they've determined is a
"residential" IP address even if you do have a domain that matches the
"from" address, an MX record, and everything else.

Eventually, I just gave up and started routing everything through the
"official" SMTP server associated with the e-mail address from which I
wanted to send the mail.

-- 
Grant Edwards   grant.b.edwardsYow! I'm having a MID-WEEK
  at   CRISIS!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tree library - multiple children

2013-12-13 Thread buchanae
I have this simple/stupid tree module:
https://github.com/abuchanan/bolts/blob/master/bolts/tree.py


On Thursday, December 12, 2013 10:14:34 AM UTC-8, Ricardo Aráoz wrote:
> I need to use a tree structure. Is there a good and known library?
> 
> Doesn't have to be binary tree, I need to have multiple children per node.
> 
> 
> 
> Thanks

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Terry Reedy

On 12/13/2013 11:15 AM, [email protected] wrote:

Le jeudi 12 décembre 2013 18:55:15 UTC+1, Terry Reedy a écrit :



If you mean cp65xxx (I forget exact numbers), MS Command Prompt fails,
not Python. One should not use any other code page, but only other code
pages work.



Please, do not exaggerate too much.


I try not to, so in case I mis-remembered, I tried your experiment.

>> echo "ሴé€㑖Ѓ⌴*"
> works.

I cut the mixed alphabet input line and pasted into a *fresh* Command 
Prompt window on my USA Win 7 machine with all updates.


C:\Users\Terry>echo "?‚*"
"?‚*"

About what I expected, except for é becoming ,. Now the test. Change the 
code page and re-paste.

'''
C:\Users\Terry>chcp 65001
Active code page: 65001

C:\Users\Terry>echo "*"
The system cannot write to the specified device.
'''
This a major fail as all non-ascii chars are deleted when pasted (at 
least visibly) and the echo does not echo. There is no Python involved 
in this failure.


I am willing to believe that you might have gotten different behavior on 
your French Win 7 machine. Windows is not an international OS, but 
rather a collection of ghettoized national versions.


As I said before, Idle does work in this regard.

Python 3.4.0a4 (v3.4.0a4:e245b0d7209b, Oct 20 2013, 19:57:58) [MSC 
v.1600 64 bit (AMD64)] on win32

>>> "ሴé€㑖Ѓ⌴*"
'ሴé€㑖Ѓ⌴*'

--
Terry Jan Reedy


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


Re: Tree library - multiple children

2013-12-13 Thread Ricardo Aráoz

El 13/12/13 18:05, [email protected] escribió:

I have this simple/stupid tree module:
https://github.com/abuchanan/bolts/blob/master/bolts/tree.py




Thanks, I'll check it.


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


Re: Filtering and blocking (was Re: Islam is the spammiest subject line on python-list)

2013-12-13 Thread Terry Reedy

On 12/13/2013 11:45 AM, Chris Angelico wrote:

On Sat, Dec 14, 2013 at 3:40 AM, Tim Golden  wrote:

However, we've recently implemented filtering via the gateway, and I've
just added bv4 to the list of banned addresses. (I'm not 100% sure I've
got it right, so let's see if they make it in again).


Thank you Tim. Since bv4... is active again, I was about to either 
request 'someone' do that, or try to figure out how.



What happens if someone else trips the filter (collateral damage)? Are
they informed that they're blocked, or does the post get black-holed?


The spam filter is different from the block list. The block_list 
discards. Nikos was warned and informed before being added. I presume 
bv4 is just blocked. The spam filter sends to a human moderator who 
either accepts or discards. The filter is not currently tuned to catch 
CoC violations, such as personal insults, from otherwise normal posters. 
If it were, moderators could reject with explanation and suggestion to 
revise.


--
Terry Jan Reedy

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Mark Lawrence

On 13/12/2013 22:49, Terry Reedy wrote:

On 12/13/2013 11:15 AM, [email protected] wrote:

Le jeudi 12 décembre 2013 18:55:15 UTC+1, Terry Reedy a écrit :



If you mean cp65xxx (I forget exact numbers), MS Command Prompt fails,
not Python. One should not use any other code page, but only other code
pages work.



Please, do not exaggerate too much.


I try not to, so in case I mis-remembered, I tried your experiment.

 >> echo "ሴé€㑖Ѓ⌴*"
 > works.

I cut the mixed alphabet input line and pasted into a *fresh* Command
Prompt window on my USA Win 7 machine with all updates.

C:\Users\Terry>echo "?‚*"
"?‚*"

About what I expected, except for é becoming ,. Now the test. Change the
code page and re-paste.
'''
C:\Users\Terry>chcp 65001
Active code page: 65001

C:\Users\Terry>echo "*"
The system cannot write to the specified device.
'''
This a major fail as all non-ascii chars are deleted when pasted (at
least visibly) and the echo does not echo. There is no Python involved
in this failure.

I am willing to believe that you might have gotten different behavior on
your French Win 7 machine. Windows is not an international OS, but
rather a collection of ghettoized national versions.

As I said before, Idle does work in this regard.

Python 3.4.0a4 (v3.4.0a4:e245b0d7209b, Oct 20 2013, 19:57:58) [MSC
v.1600 64 bit (AMD64)] on win32
 >>> "ሴé€㑖Ѓ⌴*"
'ሴé€㑖Ѓ⌴*'



Seems like we're now in the later stages of the 15, three minute rounds. 
 The trainer won't throw in the towel, the referee won't stop the fight 
and the boxer himself won't quit.  Is jmf actually trying to get himself 
killed?


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Terry Reedy

On 12/13/2013 11:27 AM, Chris Angelico wrote:

On Sat, Dec 14, 2013 at 3:15 AM,   wrote:

One should recognize, with win7, MS, finally, produce
a full unicode system. Strangely, among all the "bashing"
one can read about that system, this is rarely mentioned.
(With an excellent unicode coding scheme!)


[citation needed]


Chris, I hardly think Jim's last statement (which I presume is your 
target) is egregious enough to start another junk subthread of 9 (now 
10) posts. Certainly '[citation needed]' is a pretty senseless comment. 
'Citation' to what, for what? It is well-known that Windows uses 2-byte 
words for unicode coding. If you want a citation for that fact, find it 
yourself.


What is not clear to me is whether Windows internally uses UCS-2, which 
only codes BMP chars, and which would *not* be excellent, or UTF-16, 
which covers all chars by using surrogates. I will guess the latter. 
More to the point, even if MS uses a complete coding scheme internally 
(UFT-16), it does not, as far as I know, make it fully available and 
usable to *me*, as I showed in my response about code page 65001.


--
Terry Jan Reedy

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 10:30 AM, Terry Reedy  wrote:
> Chris, I hardly think Jim's last statement (which I presume is your target)
> is egregious enough to start another junk subthread of 9 (now 10) posts.
> Certainly '[citation needed]' is a pretty senseless comment. 'Citation' to
> what, for what? It is well-known that Windows uses 2-byte words for unicode
> coding. If you want a citation for that fact, find it yourself.
>
> What is not clear to me is whether Windows internally uses UCS-2, which only
> codes BMP chars, and which would *not* be excellent, or UTF-16, which covers
> all chars by using surrogates. I will guess the latter. More to the point,
> even if MS uses a complete coding scheme internally (UFT-16), it does not,
> as far as I know, make it fully available and usable to *me*, as I showed in
> my response about code page 65001.

And what I'm more asking for is a clarification on how Win 7 is
different from the previous Windowses. I know a lot did change from XP
to 7 (I don't care which side of Vista the change happened, let's just
compare the popular Windows with the popular Windows here), but I
wasn't aware that anything to do with Unicode had changed there. Since
jmf made the assertion in words which implied that Microsoft had now
*and only now* produced such a system, I asked for a citation.

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Ethan Furman

On 12/13/2013 03:10 PM, Mark Lawrence wrote:


Seems like we're now in the later stages of the 15, three minute rounds.  The 
trainer won't throw in the towel, the
referee won't stop the fight and the boxer himself won't quit.  Is jmf actually 
trying to get himself killed?


His credibility with me has been long dead.  :(

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


Re: Experiences/guidance on teaching Python as a first programming language

2013-12-13 Thread Mark Lawrence

On 13/12/2013 23:17, Ethan Furman wrote:

On 12/13/2013 03:10 PM, Mark Lawrence wrote:


Seems like we're now in the later stages of the 15, three minute
rounds.  The trainer won't throw in the towel, the
referee won't stop the fight and the boxer himself won't quit.  Is jmf
actually trying to get himself killed?


His credibility with me has been long dead.  :(

--
~Ethan~


With me it never lived, we've simply had to put up with his FUD for 16 
months.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Is it possible to mix python with php?

2013-12-13 Thread JL
Python is my favorite language. Very often, I am forced to use other languages 
like php because of better library support for web applications. Is it possible 
to write functions in python and then get php to call these functions?

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


Re: Is it possible to mix python with php?

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 12:42 PM, JL  wrote:
> Python is my favorite language. Very often, I am forced to use other 
> languages like php because of better library support for web applications. Is 
> it possible to write functions in python and then get php to call these 
> functions?

What sort of libraries are you needing? Often you'll be able to call
on those libraries from Python directly (eg if they're written in C,
they may well have Python as well as PHP bindings). Have a look on
python.org and PyPI for what you're after - chances are it already
exists.

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


Re: Is it possible to mix python with php?

2013-12-13 Thread Roy Smith
In article ,
 JL  wrote:

> Python is my favorite language. Very often, I am forced to use other 
> languages like php because of better library support for web applications. Is 
> it possible to write functions in python and then get php to call these 
> functions?

At one time, Songza was half PHP, half Python.  The parts ran in 
separate processes, communicating over HTTP.  I think that's probably 
what you want to do here.

If you define a clean, and well-documented interface, nobody has to know 
what language is running behind it.  Even better, if you have a 
comprehensive test suite for each interface, you can swap out 
implementations with a fair degree of confidence that you haven't broken 
anything.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using Python inside Programming Without Coding Technology (PWCT) environment.

2013-12-13 Thread Jason Friedman
>
> http://www.codeproject.com/Articles/693408/Using-Python-inside-Programming-Without-Coding-Tec
>
That page references a license file at
http://www.codeproject.com/info/cpol10.aspx but _that_ page would
display for me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request for guidance

2013-12-13 Thread David Hutto
In my opinion, a novice always tries to reinvent the wheel. Take for
example a simple text editor.

But I  would go with something that shows your creativity...like a game.
It's not just about code, but graphics/enhancements, and other evolutions
of the open source nature of programming.


On Fri, Dec 13, 2013 at 12:46 PM, jennifer stone
wrote:

> hello!
> thanks a ton for your warm response. I know the basics of python with some
> modules like pickle, urllib, re. Its kind of basic I know. but it gotta
> start somewhere and I really want to have real world experience.
> thanks
> jennifer
>
>
> On Fri, Dec 13, 2013 at 10:45 AM, jennifer stone  > wrote:
>
>> greetings
>> I am a novice who is really interested in contributing to Python
>> projects. How and where do I begin?
>> thanking you in anticipation
>>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>


-- 
Best Regards,
David Hutto
*CEO:* *http://www.hitwebdevelopment.com *
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request for guidance

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 3:48 PM, David Hutto  wrote:
> In my opinion, a novice always tries to reinvent the wheel. Take for example
> a simple text editor.

Which isn't a bad thing. Especially in that particular case, it's good
to try your hand at writing a text editor - most of the hard
grunt-work is done for you (just plop down an edit control - in some
toolkits you can even deploy a control with full source code
highlighting), so you can focus on figuring out what it is that makes
yours different. And then you'll appreciate other editors more :) But
along the way, you'll learn so much about what feels right and what
feels wrong. And maybe you can incorporate some of your own special
unique features into whatever editor you end up using... quite a few
are scriptable.

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


Re: request for guidance

2013-12-13 Thread David Hutto
Don't get me wrong, I didn't mean reinventing the wheel is a bad thing,
just that once you get the hang of things, you need to display some
creativity in your work to set yourself apart from the rest.

Nowadays, everyone's a programmer.

If it weren't for reinventing the wheel, then we wouldn't have abs(antilock
breaking systems), or new materials, or different treading for water
displacement or hydroplaning.

The point was just to try something in python, and to 'boldly go where no
'man' has gone before'.


Just to remind her that it's not just about python, but what you can
accomplish with it, and distinguish yourself from others.


On Fri, Dec 13, 2013 at 11:56 PM, Chris Angelico  wrote:

> On Sat, Dec 14, 2013 at 3:48 PM, David Hutto 
> wrote:
> > In my opinion, a novice always tries to reinvent the wheel. Take for
> example
> > a simple text editor.
>
> Which isn't a bad thing. Especially in that particular case, it's good
> to try your hand at writing a text editor - most of the hard
> grunt-work is done for you (just plop down an edit control - in some
> toolkits you can even deploy a control with full source code
> highlighting), so you can focus on figuring out what it is that makes
> yours different. And then you'll appreciate other editors more :) But
> along the way, you'll learn so much about what feels right and what
> feels wrong. And maybe you can incorporate some of your own special
> unique features into whatever editor you end up using... quite a few
> are scriptable.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Best Regards,
David Hutto
*CEO:* *http://www.hitwebdevelopment.com *
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request for guidance

2013-12-13 Thread rusi
On Saturday, December 14, 2013 10:41:09 AM UTC+5:30, David Hutto wrote:
> Don't get me wrong, I didn't mean reinventing the wheel is a bad thing, just 
> that once you get the hang of things, you need to display some creativity in 
> your work to set yourself apart from the rest.
> Nowadays, everyone's a programmer.
> If it weren't for reinventing the wheel, then we wouldn't have abs(antilock 
> breaking systems), or new materials, or different treading for water 
> displacement or hydroplaning. 
> The point was just to try something in python, and to 'boldly go where no 
> 'man' has gone before'.
> Just to remind her that it's not just about python, but what you can 
> accomplish with it, and distinguish yourself from others.

> On Fri, Dec 13, 2013 at 11:56 PM, Chris Angelico  wrote:
> On Sat, Dec 14, 2013 at 3:48 PM, David Hutto  wrote:
> > In my opinion, a novice always tries to reinvent the wheel. Take for example
> > a simple text editor.

> Which isn't a bad thing. Especially in that particular case, it's good
> to try your hand at writing a text editor - most of the hard
> grunt-work is done for you (just plop down an edit control - in some
> toolkits you can even deploy a control with full source code
> highlighting), so you can focus on figuring out what it is that makes
> yours different. And then you'll appreciate other editors more :) But
> along the way, you'll learn so much about what feels right and what
> feels wrong. And maybe you can incorporate some of your own special
> unique features into whatever editor you end up using... quite a few
> are scriptable.


For the young-n-enthu "Make haste slowly!" is usually good advice
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: request for guidance

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 4:36 PM, rusi  wrote:
> For the young-n-enthu "Make haste slowly!" is usually good advice

As the Ancient Romans said, "festina lente".

ChrisA
[1] http://math.boisestate.edu/gas/iolanthe/web_op/iol13.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The increasing disempowerment of the computer user

2013-12-13 Thread David Hutto
Three word response...Conglomerate business intelligence.


On Thu, Dec 12, 2013 at 5:59 AM, Steven D'Aprano <
[email protected]> wrote:

> On Thu, 12 Dec 2013 13:35:37 +1100, Ben Finney wrote:
>
> > Hmm, interesting Freudian slip there. I meant “cloud computing”, of
> > course. That's where the computer owner pretends their service is always
> > available and easy to access, while having terms of service that give
> > them unilateral power to kick you off with no warning, no explanation,
> > no accountability, and no recourse.
>
> Now Ben, you know that's not true. Everybody has the only recourse that
> matters: buy the company and make them do what you want them to do. How
> hard could that possibly be?
>
>
>
> --
> Steven
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Best Regards,
David Hutto
*CEO:* *http://www.hitwebdevelopment.com *
-- 
https://mail.python.org/mailman/listinfo/python-list